Lost Control: Breaking Hardware-Assisted Kernel Control-Flow Integrity with Page-Oriented Programming

No ratings

Presented at BlackHat USA 2023 by

Control-Flow Integrity (CFI) has been widely spreading from applications to the kernel to prevent Code Reuse Attacks (CRAs) such as ret2libc and Return-Oriented Programming (ROP). The CFI mechanism is based on the Control-Flow Graph (CFG) created by static analysis. It prevents unintended execution flows that deviate from that and reduces control-flow hijacking essential for CRAs. For this reason, Microsoft Windows and Linux-based operating systems have adopted it. Recently, hardware-based CFI technologies that consist of Indirect Branch Tracking (IBT) and shadow stack emerged to support it. They developed software-based CFIs to hardware-assisted CFIs, which has more strong enforcement. Hypervisor-based integrity protection mechanisms also hardened the CFIs' policies. These security mechanisms make traditional attack techniques challenging, including control flow hijacking and code manipulation.In this talk, I will introduce Page-Orient Programming (POP), a novel kernel CRA that can neutralize the hardware-assisted CFI under the hypervisor-based integrity protection mechanism. It is a new type of Data-Oriented Attack (DOA), such as Data-Oriented Programming (DOP) and Block-Oriented Programming (BOP). While traditional CRAs need to hijack the control flows with buffer-overflow vulnerabilities, POP utilizes an arbitrary memory read and write vulnerability instead. It can create new control flows by programming page tables in the kernel under strong security enforcement. It exploits two weak points. (i) The CFI is only interested in verifying indirect branches, and (ii) the hypervisor-based protection focuses on ensuring the physical page's integrity. Therefore, POP can derive malicious control flows by using direct branches instead of indirect ones and stitching legitimate kernel physical pages with the page tables. Discovering and chaining gadgets are more intuitive than other DOAs. To show the effectiveness of POP, I will demonstrate how to break the FineIBT, the latest hardware-assisted CFI in the Linux kernel, under open-source hypervisor-based integrity protection software. Lastly, I will present defense mechanisms to mitigate POP.