Skip to content
BlogPaper
Go back

Bypass UAC Technique 101 on Window Operating

Edit page

Bypass UAC Technique 101 on Window Operating

Overview

User Account Control (UAC) plays a crucial key on Windows security. UAC reduces the risk of malware by limiting the ability of malicious code to execute and get the privilige escalation.

1.png

Pay attention that Microsoft does not consider this technique as security vulnerabilities, but rather as a method of bypassing a “defense-in-depth” feature which means UAC has just been an additional layer of defense and not a security boundary.

Architecture and Operations

Architecture

UAC is executed with Application Information (AppInfo) service, ran on svchost.exe -k netsvcs -p -s Appinfo and download the appinfo.dll. When an evelate require occurs, the processing flow as follow :

Auto-Elevation condition

When a program wants to get auto-elevate without triggering UAC prompt, it is mandatory to sastify conditions:

  1. Auto Elevation Configuration — The program is configurated in auto-elevation (thường trong manifest file).
  2. Valid Digital Signature — An valid Microsoft signature.
  3. Trusted System Directory — Execution from trusted system folder like C:\Windows\System32.

Bypass UAC techniques

Registry Key Manipulation

This is a popular group technique, it works with modifying registry key that some auto-elevated program read before executing, thereby redirecting the execution flow to an attacker-controlled command. T1548.002

Some registry key is usually taked advantage :

Fodhelper.exe Bypass (UACME Method 33)

2.png

As fodhelper executes, Windows will automatically evelate it to High integrity. This process might strive to open the ‘ms-seetings’ protocol with default handler. Threat actor just need to modify registry key HKCU\Software\Classes\ms-settings\shell\open\command in order to point to the arbitrary command :

reg add HKCU\Software\Classes\ms-settings\shell\open\command /f /ve /t REG_SZ /d "cmd.exe"
reg add HKCU\Software\Classes\ms-settings\shell\open\command /v DelegateExecute /f
start fodhelper.exe

Pseodu Code

    BEGIN
    DEFINE registryPath = "Software\Classes\ms-settings\Shell\Open\command"
    DEFINE command = "cmd /c start cmd.exe"
    DEFINE delegateExecute = ""

    // Open or create the registry key under the current user
    OPEN registryKey AT registryPath WITH write_permissions

    // Write values into the registry
    SET registryKey["(default)"] = command
    SET registryKey["DelegateExecute"] = delegateExecute

    // Close the registry key
    CLOSE registryKey

    // Prepare to execute a system program with elevated privilege
    INITIALIZE shellExecuteInfo
        shellExecuteInfo.action = "run as administrator"
        shellExecuteInfo.targetFile = "C:\Windows\System32\fodhelper.exe"
        shellExecuteInfo.displayMode = normal_window
    END INITIALIZE

    // Execute the prepared system command
    EXECUTE shellExecuteInfo
END

Eventvwr.exe Bypass: Similarly, eventvwr.exe queries the key HKCU\Software\Classes\mscfile\shell\open\command before calling fallback to HKCR, allows attackers to inject payload. 3.pngSdclt.exe IsolatedCommand: This method invokes manipulating IsolatedCommand registry key associated with sdclt.exe (System Restore) in order to execute abitary command with High Priviledge.

Environment Variable Manipulation: byeintegrity5 bypass takes advantage of environment variable %windir% by modifying HKCU\Environment\windir to redirect scheduled task CDSSync to load DLL from the directory which the attacker controls. Specifically, this technique could still work even if the UAC is set to Always Notify.

Elevated COM Interface

This way involves finding out COM interface which can execute process with elevated priviledge (e.x wrapper CreateProcess/ShellExec), in order to call a process from Medium integrity.

COM InterfaceCLSIDMalware abuse
ICMLuaUtil (CMSTPLUA){3E5FC7F9-9A51-4367-9063-A120244FBEC7}DarkSide, LockBit, TrickBot
IColorDataProxyBy UACME executes
IEditionUpgradeManagerby UACME execute
IFileOperationCLSID_FileOperationVault 7 disclosure

Behaviorally, serveral COM interface executes on dllhost.exe (COM Surrogate) with command line which involves classId of COM object, creates child process with High integrity.

Trusted Path Collision (Mock Trusted Directories)

This technique exploits how Windows resolves path normalization within the process authenticate UAC:

  1. Create folder inC:\Windows \System32\.
  2. Set the programs to have manifest auto-elevate (ví dụ BitLockerWizardElev.exe) and malicious DLL into the folder.
  3. Because of path normalization, Windows can treat that this directory as a truth folder, bypass checking UAC. This technique is litteraly presented at HITCON 2019 (“Duplicate Paths Attack: Get Elevated Privilege from Forged Identities”) and SITCON 2020.

CMSTP (Connection Manager Profile Installer)

cmstp.exe is able to execute command string with elevated permission through COM interface ICMLuaUtil. By faking to look like explorer.exe, attacker calls ShellExec to this interface in order to execute abitary command with the highest priviledge.

Token Manipulation

The engineering group manipulates access token or token attribute to get the elevated permission. UACME launched a lot of method in this group, including absuse UIAccess token, DebugObject, and SSPI Datagram.

Some tools and malware abuse UAC Bypass

MITRE ATT&CK framework follows this techniques which named T1548.002 — Bypass User Account Control. A lot of popular malware have intergated bypass UAC ability like :

MalwareUAC Bypass
DarkSide, LockBit, TrickBotICMLuaUtil Elevated COM Interface
GluptebaFodHelper Execution Hijack, DiskCleanup Task Hijack
Remcos RATWindows Directory Masquerading
Cobalt Strikecombination of multiple techniques
BlackCat (ALPHV)Bypass UAC to escalate privileges
Raspberry Robinabuse fodhelper.exe to run elevated process
Quasar RATComputerDefaults Execution Hijack
RedLine StealerDiskCleanup Scheduled Task Hijack

After bypassing UAC successfully, some normal actions include : adding AV exclusion, writing down protected registry key (HKLM), and disable system recorvery.

Besides, UACME is the best popular tool, which contains more 80 bypassing method with akagi64.exe executable . The simple way is to use command line: akagi64.exe [method_number] [optional_command].

You can also read some techniques here :

Elastic: Exploring Windows UAC Bypasses: Techniques and Detection Strategies

MITRE: Abuse Elevation Control Mechanism: Bypass User Account Control


Detection Evasion

Adversary can abuse some techique to make bypass UAC more difficult to detect as :

Detection

Token Security Attributes

Elastic Security detected that could abuse token security attributes of process to determine processes ran through auto-elevated application:

DecHdAutoAp attribute is specially useful because it allows to detect UAC bypass without knowing particular techniques — just need to find supicious process (as cmd.exe, powershell.exe, rundll32.exe) run on High/System integrity and this attribute.

Monitor Event

Through MITRE ATT&CK Detection Strategy DET0388, need to monitor chain of behaviors multiple occasions incluce:

Mitigation

UAC Configuration

With MITRE ATT&CK Mitigation M1052, some method contain:


Edit page
Share this post on:

Previous Post
Crackmes : Hekliet's keygenme
Next Post
Malware Injection in Window Operating System 101