TL;DR
This paper introduces a novel "memory collision" strategy to reliably exploit use-after-free (UAF) vulnerabilities in the Linux kernel, overcoming the challenges of unpredictable kernel memory layouts. The authors demonstrate two practical attacks, an object-based and a more powerful physmap-based approach, and successfully achieve privilege escalation on Android devices, including a generic exploit for recent Android versions.
What Problem Does This Paper Address?
Exploiting vulnerabilities in user-space applications has become increasingly difficult due to robust security measures. This has led attackers to shift their focus to the operating system kernel, where vulnerabilities offer more direct and powerful control. Use-after-free (UAF) vulnerabilities, in particular, are attractive targets in the kernel. However, exploiting UAFs in the Linux kernel is notoriously challenging due to the dynamic and unpredictable nature of kernel memory allocation and deallocation, especially when information leakage is not available. Attackers traditionally resort to blind memory overwriting, which has a negligible success rate. This paper aims to bridge this gap by providing a reliable and generalizable method for exploiting kernel UAF vulnerabilities.
Methods
The core contribution of this paper is a novel memory collision strategy. The key insight is to leverage the probabilistic nature of kernel memory reuse mechanisms to intentionally create a situation where a controlled memory allocation overlaps with a freed vulnerable object. This strategy significantly increases the success rate of overwriting the critical part of the kernel.
The authors present two concrete attacks based on this strategy:
- Object-based Attack: This attack utilizes the kernel's memory recycling mechanisms, specifically targeting the SLAB/SLUB allocators. It involves two sub-types:
- Same-size object collision: Exploits the SLUB allocator's tendency to group objects of the same size into the same cache, even if they are of different types.
- Different-size object collision: A more advanced approach that circumvents the strict size-based separation of the kernel allocator, though it comes with increased uncertainty.
- Physmap-based Attack: This is presented as a more powerful and universal attack. It leverages the physmap, a large virtual memory region in the kernel that maps physical memory. By spraying user-controlled data into the physmap, attackers can overwrite freed vulnerable objects. This method is more robust because it doesn't rely on specific kernel object sizes or types and bypasses the separation mechanisms of kernel allocators from a higher-level memory management perspective.
Datasets
Not discussed in the paper. The paper focuses on exploiting existing kernel vulnerabilities and does not introduce new datasets or benchmarks.
Key Insights and Ideas
- Kernel Memory Reuse is Exploitable: The paper demonstrates that the very mechanisms designed for efficient memory management in the Linux kernel (like recycling freed memory) can be exploited to create predictable collision points.
- Probabilistic Collisions are Key: Instead of aiming for deterministic overwrites (which are hard in the kernel), the strategy focuses on creating a high probability of collision, making the attack reliable in practice.
- Physmap is a Powerful Attack Surface: The physmap, often used for other purposes, is revealed as a potent tool for UAF exploitation due to its direct mapping of physical memory and its ability to grow and potentially overlap with kernel object caches.
- Generality is Achievable: The physmap-based attack is shown to be effective across different architectures (32-bit/64-bit) and kernel versions, including Android, without requiring architecture-specific code.
- Object Isolation is Not Absolute: While kernel allocators provide object isolation, the physmap-based attack demonstrates a way to bypass this by treating the kernel memory space as a whole.
Key Results
- The authors successfully demonstrate both object-based and physmap-based attacks on a custom vulnerable kernel module.
- A practical exploit, PingPongRoot, is developed using the physmap-based attack to achieve privilege escalation on various popular Android devices (Android version >= 4.3), including those with 64-bit processors, by exploiting the CVE-2015-3636 UAF vulnerability. This is claimed to be the first generic kernel exploit for recent Android versions.
- The physmap-based attack shows high success rates (up to 98%) across different Android devices with varying RAM sizes and architectures.
- The object-based attack also shows good success rates (up to 99% for same-size collisions) but is more limited by object size constraints and memory requirements.
- The paper proposes two mitigation schemes: bounding the physmap usage per user and enforcing complete separation between the physmap and SLAB caches.
Limitations and Future Work
Limitations:
- Object-based Attack Limitations:
- The same-size object collision requires the vulnerable object's size to align with a
kmallocsize.
- The same-size object collision requires the vulnerable object's size to align with a
- The different-size object collision suffers from uncertainty and a lower success rate without information leakage.
- Physmap-based Attack Limitations:
- Time Cost: Spraying memory for the physmap can be time-consuming.
- Memory Cost: The physmap-based attack requires significant memory for spraying.
- Race Conditions: If a vulnerable object is reused very quickly after being freed, it might be difficult to overwrite it before it's accessed again, potentially leading to crashes.
- Internal Kernel Objects: Exploiting UAFs on internal kernel objects that cannot be easily instantiated by attackers might be harder.
- Limited Physical Memory: Insufficient physical RAM can limit the amount of data an attacker can spray, reducing the effectiveness of the physmap attack.
Future Work:
The paper implicitly suggests that further research into more efficient memory spraying techniques and more robust mitigation strategies would be beneficial. The proposed mitigations also have trade-offs (e.g., complete separation might incur overhead), indicating areas for further optimization and study.
Summary updated