CATTmew: Defeating Software-Only Physical Kernel Isolation

Yueqiang Cheng, Zhi Zhang, Surya Nepal, Zhi Wang

TL;DR

This paper introduces "CATTmew," a novel exploit that bypasses software-only physical kernel isolation defenses designed to prevent rowhammer attacks. By exploiting a "double-owned memory" vulnerability and a new "memory ambush" technique, CATTmew allows an unprivileged user process to gain root and kernel privileges with minimal memory footprint and without relying on traditional exploit prerequisites.

What Problem Does This Paper Address?

Modern operating systems rely on memory management units (MMUs) to enforce isolation between user processes and the kernel, preventing malicious user code from corrupting critical kernel data structures. Rowhammer attacks, however, exploit a hardware vulnerability in DRAM where repeatedly accessing certain memory rows can cause bit flips in adjacent rows, potentially corrupting sensitive data like page tables. To counter this, a defense called "physical kernel isolation" (part of CATT) was proposed, which physically separates kernel and user memory partitions. This paper addresses the critical flaw in this defense: the existence of "double-owned memory," where kernel-allocated memory is also mapped into user space. This shared ownership invalidates the physical separation, allowing rowhammer attacks to target kernel memory even with CATT in place. Existing rowhammer exploits often require significant memory usage or access to sensitive system information, making them detectable. This paper aims to develop a stealthier and more efficient exploit that overcomes these limitations.

Methods

The core of the attack, CATTmew, is built upon several novel techniques:

  • Memory Ambush: This technique allows an attacker to strategically place "hammerable" double-owned buffers (like video or SCSI buffers) physically adjacent to critical kernel data structures (like page tables) using only a small amount of memory. It leverages the Linux kernel's mmap system call and its buddy physical page allocator. The attacker repeatedly maps a temporary file into user space, forcing the kernel to allocate page-table pages. By carefully managing memory allocation and depletion, the attacker can ensure that the double-owned buffers and page tables end up in adjacent DRAM rows.
  • Efficient Hammering (Timing Channel): Since direct access to virtual-to-physical address mappings is often restricted, CATTmew employs an improved single-sided hammering technique. It utilizes a timing channel based on row-buffer conflicts within DRAM banks. By measuring the latency of accessing pairs of addresses, the attacker can identify pairs that are likely in different rows within the same bank. Repeatedly hammering these "DRSB" (different rows within same bank) pairs is more efficient at inducing bit flips than random hammering.
  • Exploiting Double-Owned Buffers: The attack identifies specific kernel buffers that are allocated from the kernel partition but can be mapped into user space. Video buffers (from Video4Linux) and SCSI Generic (sg) buffers are used as examples. These buffers act as the "aggressor rows" for the rowhammer attack.
  • Privilege Escalation: Once bit flips in the page tables are achieved, the attacker gains read/write access to all system memory, effectively achieving kernel privilege. The paper also details how to gain root privilege by locating and modifying the struct cred (credential structure) in memory.

Datasets

Not discussed in the paper. The experiments were conducted on two physical machines with specific hardware configurations (Dell Latitude E6420 and Lenovo Thinkpad T420) running specific Linux kernel versions (4.10.0 and 4.8.0).

Key Insights and Ideas

  • Double-Owned Memory is a Critical Vulnerability: The paper highlights that even physically isolated memory partitions can be compromised if memory ownership is dynamic and shared between kernel and user space. This is a fundamental flaw in the static partitioning approach of CATT.
  • Memory Ambush for Stealth and Efficiency: The "memory ambush" technique is a significant contribution, enabling attackers to achieve precise physical memory placement for rowhammer attacks without the need for large memory footprints or complex memory exhaustion techniques. This makes the attack much stealthier.
  • Timing Channels for Efficient Hammering: Leveraging DRAM timing channels to identify optimal hammerable address pairs is a clever way to overcome the lack of direct memory mapping information, improving the efficiency and success rate of the attack.
  • Practical Exploitation on Modern Systems: The paper demonstrates that these techniques are not theoretical but can be practically implemented on contemporary Linux systems to achieve full kernel compromise.

Key Results

  • Successful Kernel Privilege Escalation: CATTmew successfully demonstrated the ability to gain root and kernel privileges from an unprivileged user process.
  • Stealthy and Low Memory Footprint: The "memory ambush" technique required a minimal memory footprint, as low as 88MB in some experiments.
  • Fast Attack Execution: The successful exploit could be completed within 1 minute on the tested hardware.
  • High Success Rate: The memory ambush technique consistently succeeded in positioning buffers adjacent to page tables (100% success rate in positioning). The overall exploit success rate varied but was significant.
  • Efficiency Improvement: The proposed hammering technique was shown to be significantly more efficient (up to 1080 times faster) than traditional single-sided rowhammering.

Limitations and Future Work

  • Hardware Vulnerability: The attack relies on the underlying DRAM being susceptible to rowhammer bit flips. The paper notes that many mainstream DRAM modules are vulnerable.
  • Dynamic Analysis Detection: The paper acknowledges that the exploit's specific instructions and memory access patterns could potentially be detected by static or dynamic analysis tools.
  • Future Work: The authors suggest exploring practical defenses against their exploit, such as isolating double-owned memory with guard rows, though they note this might not be scalable for all shared buffers. They also mention the need for a program analysis system to automatically identify hammerable buffers.

Summary updated

BibTeX
@article{cheng2021cattmew,
  author = {Yueqiang Cheng and Zhi Zhang and Surya Nepal and Zhi Wang},
  title = {{CATTmew: Defeating Software-Only Physical Kernel Isolation}},
  journal = {IEEE Trans. Dependable Secur. Comput.},
  year = {2021},
  doi = {10.1109/tdsc.2019.2946816},
}
Figure