@nickeverdox / @0xNemi
WHY SO SPURIOUS?
How a Highly Error-Prone x86/x64 CPU "Feature" can be Abused to Achieve Local Privilege Escalation on Many Operating Systems
PRESENTATION TOPICS
NICK PETERSON
@nickeverdox
www.everdox.net
Anti-Cheat Engineer @ Riot Games
NEMANJA MULASMAJIC
@0xNemi
Anti-Cheat Engineer @ Riot Games
www.triplefault.io
CVE-2018-8897
PREREQUISITE KNOWLEDGE
“TRADITIONAL” PRIVILEGE LEVELS
WHAT IN THE WORLD IS A #DB?
INTERRUPTS AND THE IDT
In Windows, the INT 1 handler was nt!KiDebugTrapOrFault pre-KPTI.�Nowadays, it’s nt!KiDebugTrapOrFaultShadow.
THE STACK WHEN AN INTERRUPT OCCURS
SEGMENTATION
SEGMENTATION cont.
THE INT 1 HANDLER, KIDEBUGTRAPORFAULT
SWAPGS
MOV/POP SS
How did we discover this?
DISCOVERY
IMAGINE THIS SCENARIO...
The INT 3 executes in the context of usermode code.
20
SO, WHAT HAPPENS?
This causes a branch to the INT 3 handler in kernelmode, which is KiBreakpointTrap
Before KiBreakpointTrap executes its first instruction, the pending #DB is fired (which was suppressed by MOV SS) and execution redirects to KiDebugTrapOrFault
KiDebugTrapOrFault is entered with a kernelmode CS.�
1
2
3
4
Demo: A local DoS
github.com/nmulasmajic/
CVE-2018-8897
github.com/nmulasmajic/
CVE-2018-8897
github.com/nmulasmajic/
CVE-2018-8897
github.com/nmulasmajic/
CVE-2018-8897
MOV/POP SS AVOIDS THE SWAPGS
WRGSBASE
QUICK RECAP
INITIAL WEAPONIZING
CHALLENGES
CHALLENGES cont.
MORE CHALLENGES...
QUICK RECAP
THE SYSCALL HANDLER, KISYSTEMCALL64
SYSCALL executes in the context of usermode code.�
36
SYSCALL FUNCTIONS SIMILAR TO INT 3�
This causes a branch to the SYSCALL handler in kernelmode, which is KiSystemCall64.�
Before KiSystemCall64 executes its first instruction, the pending #DB is fired (which was suppressed by MOV/POP SS) and execution redirects to KiDebugTrapOrFault�
KiDebugTrapOrFault is entered with a kernelmode CS and with a usermode stack (since the stack swap doesn’t complete in KiSystemCall64).�
2
1
3
4
Demo: LPE using SYSCALL
github.com/nmulasmajic/�syscall_exploit_CVE-2018-8897�
github.com/nmulasmajic/�syscall_exploit_CVE-2018-8897�
github.com/nmulasmajic/�syscall_exploit_CVE-2018-8897�
github.com/nmulasmajic/�syscall_exploit_CVE-2018-8897�
https://github.com/nmulasmajic/
syscall_exploit_CVE-2018-8897
github.com/nmulasmajic/�syscall_exploit_CVE-2018-8897�
https://github.com/nmulasmajic/
syscall_exploit_CVE-2018-8897
github.com/nmulasmajic/�syscall_exploit_CVE-2018-8897�
github.com/nmulasmajic/�syscall_exploit_CVE-2018-8897�
github.com/nmulasmajic/�syscall_exploit_CVE-2018-8897�
github.com/nmulasmajic/�syscall_exploit_CVE-2018-8897�
github.com/nmulasmajic/�syscall_exploit_CVE-2018-8897�
github.com/nmulasmajic/�syscall_exploit_CVE-2018-8897�
github.com/nmulasmajic/�syscall_exploit_CVE-2018-8897�
MOST OSVS ROLLED OUT FIXES FOR THIS EXPLOIT IN MAY...
MICROSOFT’S FIX
MICROSOFT’S FIX
SHOUTOUTS TO...
LESSONS LEARNED