Upgrade to Pro — share decks privately, control downloads, hide ads and more …

Administrator Protection Bypass

Suzu
October 26, 2026

Administrator Protection Bypass

2026.10.22

Suzu

October 26, 2026

Transcript

54 slides
  1. UAC vs. AP UAC AP Linked Token Linked Token Remaining

    Token Remaining Token Linked Token Remaining Token Shadow Admin Token (with new SID)
  2. Outline What were covering • Access Token Structure • How

    DosDevice works? • What is an impersonation? • Object Manager Demos • DoSDevice EoP • DoSDevice Race Condition EoP
  3. DoS Device EoP initialized Access Denied Calling Shadow Admin User

    RPC Impersonation Thread AppInfo elevation cmd.exe Create DOS Dir. not initialized Lazy init. Identi cationLevel Token (Not Trusted) Primary Token ZwCreateDirectoryObject() DuplicateTokenEx() Primary Token Identi cationLevel Token Catch STATUS_BAD_IMPERSONATION_LEVEL Symbolic Link DoSDevices C: -> \GLOBAL??\C:\fakec Primary Token take place ownership fi fi Shadow Admin gets into the fakec dir. DLL Sideloading Bypass
  4. DoS Device EoP initialized Access Denied Calling Shadow Admin User

    RPC Impersonation Thread AppInfo elevation cmd.exe Identi Create DOS Dir. not initialized Lazy init. (Not Trusted) Primary Token ZwCreateDirectoryObject() DuplicateTokenEx() Primary Token Identi Catch STATUS_BAD_IMPERSONATION_LEVEL Symbolic Link DoSDevices C: -> \GLOBAL??\C:\fakec Primary Token take place ownership fi fi Shadow Admin gets into the fakec dir. DLL Sideloading cmd.exe (elevated)
  5. DoS Device EoP initialized Access Denied Calling Shadow Admin User

    RPC Impersonation Thread AppInfo elevation cmd.exe Identi Create DOS Dir. not initialized Lazy init. (Not Trusted) Primary Token ZwCreateDirectoryObject() DuplicateTokenEx() Primary Token Identi cationLevel Token Catch STATUS_BAD_IMPERSONATION_LEVEL Symbolic Link DoSDevices C: -> \GLOBAL??\C:\fakec Primary Token take place ownership fi fi Shadow Admin gets into the fakec dir. DLL Sideloading cmd.exe (elevated)
  6. Access Token Group SIDs Privileges Default Owner Primary Group DACL

    Source Type Impersonation Level Statistics Restricting SIDs TS session ID Session Reference Sandbox Inert Audit Policy Origin Logon Session Cached Credentials Lsass.exe
  7. Impersonation ) ( n ke Op Server SYSTEM Token o

    r P en o T s ces Primary Access Token Impersonation Token Impersonation Access Token Ope nThr eadT oken ( ) RPC(MSRPC) User Delegate Client’s local & network credentials can be passed Impersonate Can access local resources as the client Identify Default. Obtain ID & do ACL checks Anonymous Does not contain any information. Local interprocess communication. User Token
  8. Impersonation ) ( n ke o r P en o

    T s ces Primary Access Token Op Server SYSTEM Token Impersonation Token Impersonation Access Token Ope nThr eadT oken ( ) RPC(MSRPC) User Delegate Client’s local & network credentials can be passed Impersonate Can access local resources as the client Identify Default. Obtain ID & do ACL checks Anonymous Does not contain any information. Local interprocess communication. User Token
  9. Impersonation ) ( n ke o r P en o

    T s ces Primary Access Token Op Server SYSTEM Token Impersonation Token Impersonation Access Token Ope nThr eadT oken ( ) RPC(MSRPC) User Delegate Client’s local & network credentials can be passed Impersonate Can access local resources as the client Identify Default. Obtain ID & do ACL checks Anonymous Does not contain any information. Local interprocess communication. User Token
  10. Impersonation ) ( n ke o r P en o

    T s ces Primary Access Token Op Server SYSTEM Token Impersonation Token Impersonation Access Token Ope nThr eadT oken ( ) RPC(MSRPC) User Delegate Client’s local & network credentials can be passed Impersonate Can access local resources as the client Identify Default. Obtain ID & do ACL checks Anonymous Does not contain any information. Local interprocess communication. User Token
  11. securitybaseapi.h AccessCheck() AccessCheckByType() Server Check Private Object AccessCheckByTypeResultList() AdjustTokenPrivileges() Impersonation

    Access Token securitybaseapi.h winht.h Update pointer to TOKEN_PRIVILEGES TOKEN_PRIVILEGES securitybaseapi.h PrivilegeCheck() Check the pointer to PRIVILEGE_SET winbase.h ObjectOpenAuditAlarmA() PrivilegedServiceAuditAlarmA() Generate audit messages
  12. DoS Device EoP initialized Access Denied Calling Shadow Admin User

    RPC Impersonation Thread AppInfo elevation cmd.exe Identi Create DOS Dir. not initialized Lazy init. (Not Trusted) Primary Token ZwCreateDirectoryObject() DuplicateTokenEx() Primary Token Identi Catch STATUS_BAD_IMPERSONATION_LEVEL Symbolic Link DoSDevices C: -> \GLOBAL??\C:\fakec Primary Token take place ownership fi fi Shadow Admin gets into the fakec dir. DLL Sideloading cmd.exe (elevated)
  13. DoSDevices • Device name that Windows Object Manger provide for

    reference. • e.g. “C:”, “COM1”, “Serial0” • Apps can take it to access NT Object Devices
  14. Object Manager Structure HarddiskVolume3 Device Null Serial0 C: -> /Device/HarddiskVolume3

    / \GLOBAL?? NUL -> /Device/Null COM1 -> /Device/Serial0 00000000-00123456 (LOGON 1) Sessions 0 DOSDevices 00000000-007890AB (LOGON 2) DOSDevices \??
  15. Object Manager Structure HarddiskVolume3 / Device Null (Objects Dir) Serial0

    (Device Objects) C: -> /Device/HarddiskVolume3 (Symbolic Links) NUL -> /Device/Null \GLOBAL?? (Objects Dir) COM1 -> /Device/Serial0 00000000-00123456 (LOGON 1) Sessions 0 DOSDevices 00000000-007890AB (LOGON 2) DOSDevices \?? (Capability Alias)
  16. \Device • IoCreateObject(…); • e.g. A driver create the \Device\MyDevice,

    it will be mapped into the DEVICE_OBJECT in the kernel memory
  17. \Device • When IO Manager is handling the open request

    of this device -> it handle the IO using the driver/device stack • We can’t expect the Win32 apps to know what the NT paths are when we pass it like \Device\whateverdevice into CreateFileW() • Therefore, we need another one for help.
  18. \DoSDevices Win32 Path C:\Windows\text.txt NT Path (DOS Prefix) \??\C:\Windows\test.txt DOSDevices

    Mapping C: -> \Device\HarddiskVolume3 NT Device Path \Device\HarddiskVolume3\Windows\test.txt
  19. Local Shadowing Access \??\C: Local DoSDevices Local Mapping Find current

    DoSDevices context Not Found \GLOBAL??\C: Global Mapping
  20. DoS Device EoP initialized Access Denied Calling Shadow Admin User

    RPC Impersonation Thread AppInfo elevation cmd.exe Create DOS Dir. not initialized Lazy init. Identi cationLevel Token (Not Trusted) Primary Token ZwCreateDirectoryObject() DuplicateTokenEx() Primary Token Identi Catch STATUS_BAD_IMPERSONATION_LEVEL Symbolic Link DoSDevices C: -> \GLOBAL??\C:\fakec Primary Token take place ownership fi fi Shadow Admin gets into the fakec dir. DLL Sideloading cmd.exe (elevated)
  21. SID • Every user has one for identi cation •

    It will be transfered into Binary through ConvertStringSidToSid() S-R-X Y1-Y2-…-Yn-1 Domain which SID Pre x fi fi the Local SAM account stays in Yn RID
  22. Local Shadowing Access \??\C: Local DoSDevices Local Mapping Find current

    DoSDevices context Not Found \GLOBAL??\C: Global Mapping
  23. Local Shadowing Access \??\C: Local DoSDevices Local Mapping Find current

    DoSDevices context Not Found \GLOBAL??\C: Where is my \GLOBAL?? Global Mapping
  24. High Delegate Client’s local & network credentials can be passed

    Impersonate Can access local resources as the client Identify Default. Obtain ID & do ACL checks Anonymous Does not contain any information. Local interprocess communication. Low Not enough to control admin
  25. DoS Device EoP initialized Access Denied Calling Shadow Admin User

    RPC Impersonation Thread AppInfo elevation cmd.exe Create DOS Dir. not initialized Lazy init. Identi cationLevel Token (Not Trusted) Primary Token ZwCreateDirectoryObject() DuplicateTokenEx() Primary Token Identi Catch STATUS_BAD_IMPERSONATION_LEVEL Symbolic Link DoSDevices C: -> \GLOBAL??\C:\fakec Primary Token take place ownership fi fi Shadow Admin gets into the fakec dir. DLL Sideloading cmd.exe (elevated)
  26. DoS Device EoP initialized Access Denied Calling Shadow Admin User

    RPC Impersonation Thread AppInfo elevation cmd.exe Identi Create DOS Dir. not initialized Lazy init. (Not Trusted) Primary Token ZwCreateDirectoryObject() DuplicateTokenEx() Primary Token Identi Catch STATUS_BAD_IMPERSONATION_LEVEL Symbolic Link DoSDevices C: -> \GLOBAL??\C:\fakec Primary Token take place ownership fi fi Shadow Admin gets into the fakec dir. DLL Sideloading cmd.exe Bypass (elevated)
  27. DoS Device EoP initialized Access Denied Calling Shadow Admin User

    RPC Impersonation Thread AppInfo elevation cmd.exe Create DOS Dir. not initialized Lazy init. Identi cationLevel Token (Not Trusted) Primary Token ZwCreateDirectoryObject() DuplicateTokenEx() Primary Token Identi cationLevel Token Catch STATUS_BAD_IMPERSONATION_LEVEL Symbolic Link DoSDevices C: -> \GLOBAL??\C:\fakec Primary Token take place ownership fi fi Shadow Admin gets into the fakec dir. DLL Sideloading cmd.exe Bypass (elevated)
  28. DoS Device EoP initialized Access Denied Calling Shadow Admin User

    RPC Impersonation Thread AppInfo elevation cmd.exe Create DOS Dir. not initialized Lazy init. Identi cationLevel Token (Not Trusted) Primary Token ZwCreateDirectoryObject() DuplicateTokenEx() Primary Token Identi cationLevel Token Catch STATUS_BAD_IMPERSONATION_LEVEL Symbolic Link DoSDevices C: -> \GLOBAL??\C:\fakec Primary Token take place ownership fi fi Shadow Admin gets into the fakec dir. DLL Sideloading cmd.exe Bypass (elevated)
  29. DoS Device EoP initialized Access Denied Calling Shadow Admin User

    RPC Impersonation Thread AppInfo elevation cmd.exe Identi Create DOS Dir. not initialized Lazy init. (Not Trusted) Primary Token ZwCreateDirectoryObject() DuplicateTokenEx() Primary Token Identi Catch STATUS_BAD_IMPERSONATION_LEVEL Symbolic Link DoSDevices C: -> \GLOBAL??\C:\fakec Primary Token take place ownership fi fi Shadow Admin gets into the fakec dir. DLL Sideloading cmd.exe (elevated)
  30. DoS initialized Access Denied Calling Shadow Admin User RPC Impersonation

    Thread AppInfo elevation cmd.exe DuplicateTokenEx() Primary Token t a h Identi Symbolic Link DoSDevices T C: -> \GLOBAL??\C:\fakec Create DOS Dir. not initialized Lazy init. o g t . d o o n is fi (Not Trusted) Primary Token ZwCreateDirectoryObject() Catch STATUS_BAD_IMPERSONATION_LEVEL Primary Token take place ownership Shadow Admin gets into the fakec dir. fi Identi DLL Sideloading cmd.exe (elevated)
  31. DoS Device EoP initialized Access Denied Calling Shadow Admin User

    RPC Impersonation Thread AppInfo elevation cmd.exe Identi Create DOS Dir. not initialized Lazy init. (Not Trusted) Primary Token ZwCreateDirectoryObject() DuplicateTokenEx() Primary Token Identi Catch STATUS_BAD_IMPERSONATION_LEVEL Symbolic Link DoSDevices C: -> \GLOBAL??\C:\fakec Primary Token take place ownership fi fi Shadow Admin gets into the fakec dir. DLL Sideloading cmd.exe (elevated)
  32. Race Condition Attacker Thread OpenProcessToken() DuplicateTokenEx() trigger lazy init for

    \?? Success Scheduled Loader opens le DoS dir. Created Failed Admin Thread fi winning line
  33. Q&A

Other Decks in Programming