User Account Control (UAC)
User Account Control (UAC) is a feature that enables a consent prompt for elevated activities. When UAC is in place, a user can log into their system with their standard user account. When processes are launched using a standard user token, they can perform tasks using the rights granted to a standard user. Some applications require additional permissions to run, and UAC can provide additional access rights to the token for them to run correctly.
How it works
This page discusses how UAC works in great depth and includes the logon process, user experience, and UAC architecture. Administrators can use security policies to configure how UAC works specific to their organization at the local level (using secpol.msc), or configured and pushed out via Group Policy Objects (GPO) in an Active Directory domain environment. The various settings are discussed in detail here.
There are 10 Group Policy settings that can be set for UAC. The following table provides additional detail: Source
UAC should be enabled, and although it may not stop an attacker from gaining privileges, it is an extra step that may slow this process down and force them to become noisier.
The default RID 500 administrator
account always operates at the high mandatory level. With Admin Approval Mode (AAM) enabled, any new admin accounts we create will operate at the medium mandatory level by default and be assigned two separate access tokens upon logging in.
Checking Current User
Output:
Confirming Admin Group Membership:
Output:
Reviewing User Privileges:
Confirming UAC is Enabled:
Output:
REG_DWORD 0x1: The value 1 means UAC is turned ON.
Checking UAC Level:
Output:
The value of ConsentPromptBehaviorAdmin
is 0x5
, which means the highest UAC level of Always notify
is enabled. There are fewer UAC bypasses at this highest level.
Checking Windows Version:
Output:
To match the Build with the version see: https://en.wikipedia.org/wiki/Windows_10_version_history
The UACME project (see below) maintains a list of UAC bypasses, including information on the affected Windows build number, the technique used, and if Microsoft has issued a security update to fix it.
SystemPropertiesAdvanced.exe DLL Hijacking UAC Bypass
Auto-elevating binaries technique
The 32-bit version of SystemPropertiesAdvanced.exe
attempts to load the non-existent DLL srrstr.dll, which is used by System Restore functionality.
When attempting to locate a DLL, Windows will use the following search order.
- The directory from which the application loaded.
- The system directory
C:\Windows\System32
for 64-bit systems. - The 16-bit system directory
C:\Windows\System
(not supported on 64-bit systems) - The Windows directory.
- Any directories that are listed in the PATH environment variable.
Reviewing Path Variable
This reveals the default folders below.
If we see a folder within the user's profile and writable by the user (in the example, the WindowsApps
folder), we can potentially bypass UAC in this by using DLL hijacking by placing a malicious srrstr.dll
DLL to WindowsApps
folder, which will be loaded in an elevated context.
Generating Malicious srrstr.dll DLL
Starting Python HTTP Server on Attack Host
Downloading DLL Target
Download the malicious DLL to the target system.
Note that we will be using the path of the writable folder that is included within the PATH variable.
Starting nc Listener on Attack Host
Testing Connection
We can run the DLL using rundll32.exe to get a reverse shell connection.
Once we get a connection back, we'll see normal user rights:
Executing SystemPropertiesAdvanced.exe on Target Host
Before proceeding, we should ensure that any instances of the rundll32 process from our previous execution have been terminated.
Output:
Therefore, killing the processes:
Now, we can try the 32-bit version of SystemPropertiesAdvanced.exe
from the target host (don't forget to previously set the listener):
UAC bypasses
UACME
The UACME project maintains a list of UAC bypasses, including information on the affected Windows build number, the technique used, and if Microsoft has issued a security update to fix it.
Repo: https://github.com/hfiref0x/UACME