repositories

daemon-sec-cheatsheet

The cheatsheet vault for operators: AD, enumeration, exploitation, priv-esc, web, DFIR

clonegit clone https://git.daemon-sec.xyz/daemon-sec-cheatsheet.git
uiaccess-admin-protection-bypass.mdMarkdown75 lines7.8 KiBsource raw download

title: "Admin Protection Bypasses via UIAccess" section: "Windows" sectionSlug: "windows-hardening" sourcePath: "src/windows-hardening/windows-local-privilege-escalation/uiaccess-admin-protection-bypass.md" sourceUrl: "https://github.com/HackTricks-wiki/hacktricks/blob/188de82beb54e70956b2952367a0af91d26758b8/src/windows-hardening/windows-local-privilege-escalation/uiaccess-admin-protection-bypass.md" sha: "188de82beb54e70956b2952367a0af91d26758b8" isIndex: false modified: true license: "CC-BY-NC-4.0"#

Admin Protection Bypasses via UIAccess#

Overview#

Token shaping and integrity levels#

Why UIAccess enables an Admin Protection escape#

HWND-to-process handle primitive (GetProcessHandleFromHwnd / NtUserGetWindowProcessHandle)#

Secure-directory validation weaknesses (AppInfo AiCheckSecureApplicationDirectory)#

AppInfo resolves the supplied path via GetFinalPathNameByHandle and then applies string allow/deny checks against hardcoded roots/exclusions. Multiple bypass classes stem from that simplistic validation:

Attack workflow (High IL without a prompt)#

  1. Obtain/build a signed UIAccess binary (manifest uiAccess="true"). For a realistic assessment, test with trust material and paths explicitly authorized for the lab; do not add an attacker certificate to a production machine's Local Machine root store.
  2. Place it where AppInfo’s allowlist accepts it (or abuse a path-validation edge case/writable artifact as above).
  3. Call RAiLaunchAdminProcess to spawn it silently with UIAccess + elevated IL.
  4. From that High-IL foothold, target another High-IL process on the desktop using window hooks/DLL injection or other same-IL primitives to fully compromise the admin context.[1]

Enumerating candidate writable paths#

Run the PowerShell helper to discover writable/overwritable objects inside nominally secure roots from the perspective of a chosen token:[1]

$paths = "C:\\Windows","C:\\Program Files","C:\\Program Files (x86)"
Get-AccessibleFile -Win32Path $paths -Access Execute,WriteData `
  -DirectoryAccess AddFile -Recurse -ProcessId <PID>

Secure Desktop accessibility registry propagation LPE (RegPwn):

Secure Desktop Accessibility Registry Propagation Regpwn

References#