February 10, 2025
October 3, 2024

How to Bypass UAC in Windows Using netplwiz and the Mitigations to Prevent It

Introduction

Imagine you’ve just opened what seemed like a harmless document. Unbeknownst to you, a hidden script silently runs in the background, exploiting a loophole in Windows security. No alarms sound, no warnings flash—just a normal day at work. But in reality, an attacker is using a User Account Control (UAC) bypass to gain full access to your system, and you never see it coming.

A UAC bypass illustration

User Account Control (UAC) is designed to protect you from this very scenario, serving as a gatekeeper by prompting for elevated permissions when an application attempts to make critical changes to your system. However, attackers have learned how to bypass these protections to gain full control of compromised systems. This article delves into the mechanics of UAC, explains how attackers use a tool like netplwiz to bypass it, and explores effective strategies for defending against such attacks.

The Importance of User Account Control (UAC)

In many ways, User Account Control (UAC) is like a security guard standing between your system and potential threats. Here’s why it’s critical:

Prevention of Unauthorized Changes: Much like that security guard stopping anyone suspicious, UAC requires explicit user consent before granting administrative access, blocking unauthorized changes to critical system settings.

User Awareness: UAC prompts make users aware when an application is attempting to perform high-risk actions, giving them the power to deny access if something feels off.

Integrity Levels: UAC operates on different integrity levels, assigning higher security to processes that could modify system configurations. This restricts lower-level programs from accessing critical resources, limiting potential damage from malicious applications.

How Attackers Exploit UAC: A Step-by-Step Guide

Let’s step into the shoes of an attacker for a moment. You’ve compromised a standard user’s account on a Windows system, but to fully own the system, you need administrative privileges. The challenge? You don’t want to trigger a UAC prompt, which would alert the user and possibly security systems. Instead, you opt for a stealthier approach: bypassing UAC with netplwiz.

netplwiz, a legitimate Windows utility, is designed for user account management. However, it also provides a pathway for attackers to gain elevated privileges. Here’s how an attacker would do it:

Steps to Reproduce UAC Bypass Using netplwiz

Note: These steps showcase a method attackers might use to exploit UAC. The purpose here is to provide defenders with the necessary knowledge to protect against such attacks.

  1. Open Command Prompt as a Low Privileged User:
  2. The attacker starts by opening a command prompt without administrative privileges perhaps they’ve phished a user’s credentials or exploited a vulnerability to gain access.
  3. Execute netplwiz:
  4. Next, the attacker types netplwiz into the command prompt and presses Enter. This launches the User Accounts window, a seemingly benign utility that, in the wrong hands, becomes a gateway to system control.
Netplwix User Accounts Panel
  1. Access Advanced User Management:
  2. From the User Accounts window, the attacker clicks the Advanced button twice. This action opens the Local Users and Groups Manager (lusrmgr), where they can view and manipulate user accounts.
Netplwiz User Account Panel Advanced Tab
  1. Open Help Topics:
  2. Inside lusrmgr, the attacker clicks Help and selects Help Topics, which brings up the Microsoft Management Console (MMC).
Local Users and Groups Manager (lusrmgr) Window
  1. View Source:
  2. In the MMC window, the attacker right-clicks and selects View Source. A Notepad window opens, showing source code related to user management.
Microsoft Management Console (MMC)
  1. Open File Dialog:
  2. Using Notepad, the attacker selects File > Open, which triggers a file dialog box—allowing them to browse the system.
Source code related to user management.
  1. Navigate to the System32 Directory:
  2. In this dialog box, the attacker navigates to C:\windows\system32 and changes the file type filter to “All Files,” unlocking access to system files.
Saving file to  C:\windows\system32
  1. Run Command Prompt as Administrator:
  2. Here’s the critical step: the attacker locates cmd.exe, right-clicks, and selects Run as Administrator. Without ever triggering a UAC prompt, they now have full administrative control of the system.
Running CMD.exe as administrator

At this point, the attacker has bypassed UAC, achieved elevated privileges, and gained control over the system without raising any alarms. It’s as if they’ve slipped past the security guard undetected.

How to Defend Against UAC Bypass Attacks

Now that we’ve seen how attackers can bypass UAC, let’s shift gears and discuss how you, as a defender, can prevent this from happening. By understanding these techniques, you can stay one step ahead of attackers and reinforce your security defenses.

  • Enforce High UAC Settings:
  • Think of this as giving your security guard more authority. By configuring UAC to its highest setting, you ensure that all administrative actions require explicit user consent, reducing the risk of silent privilege escalation.
  • Implement Application Whitelisting:
  • Application whitelisting allows you to pre-approve only trusted applications, keeping malicious programs off the system. This effectively locks the gates, ensuring that only authorized users can enter.
  • Regular Software Updates:
  • Attackers often exploit vulnerabilities in outdated software to bypass security mechanisms like UAC. By regularly updating your software, you close known security gaps, keeping attackers out.
  • Apply the Principle of Least Privilege (PoLP):
  • Limit users to the minimum level of access necessary to perform their jobs. This principle ensures that even if an attacker compromises a user account, the damage they can cause is minimized.
  • Deploy Advanced Endpoint Protection:
  • Next-gen endpoint protection systems monitor for unusual activity, such as UAC bypass attempts. These systems can act like a surveillance camera, detecting suspicious behavior and shutting it down before it causes harm.
  • Conduct Regular Security Audits:
  • By routinely auditing your systems, you can spot vulnerabilities that might allow attackers to bypass UAC. A proactive audit is like doing a routine security check to ensure your defenses are intact.
  • Educate Users About UAC:
  • Train your users to understand the importance of UAC prompts and how to respond to them. Educating your employees turns them into an extra line of defense, preventing them from inadvertently granting attackers elevated access.

TrickBot's Silent UAC Bypass: Elevating Without a Sound

TrickBot, one of the most adaptable malware strains, often bypasses User Account Control (UAC) to escalate privileges without alerting the user. One of its techniques involves exploiting the WSReset.exe utility, a high-integrity, auto-elevated program in Windows, to bypass UAC prompts. This method allows TrickBot to execute commands with elevated privileges, enabling it to disable security measures, install further malware, and spread laterally through networks—all without triggering UAC notifications​(Fortinet)​(Palo Alto Networks).

This bypass highlights the importance of proactive defenses, as attackers continue exploiting legitimate system features to stay undetected.

Conclusion

User Account Control (UAC) is a crucial security layer in Windows systems, designed to prevent unauthorized changes by requiring user consent for elevated actions. However, as we’ve seen, determined attackers can exploit loopholes—like the netplwiz UAC bypass—to evade these protections.

By taking a proactive approach—enforcing high UAC settings, deploying advanced endpoint protection, and educating users—you can significantly reduce the risk of UAC bypass and protect your systems from privilege escalation attacks. As attackers continue to evolve, staying informed and implementing robust defense strategies is your best line of defense.

Recent blog

View all blog