KernelSnitch: Leaking Kernel Heap Pointers by Exploiting Software-Induced Side-Channel Leakage of Kernel Hash Tables
This talk introduces KernelSnitch, a novel side-channel attack that exploits timing differences in Linux kernel hash table operations to leak sensitive kernel heap pointers. By manipulating the occupancy level of hash buckets through syscalls, an unprivileged user can amplify these timing differences to reliably identify kernel memory addresses. This technique provides a critical primitive for bypassing KASLR, significantly increasing the reliability of subsequent kernel exploits. The researchers demonstrate the attack on the Linux kernel's futex hash table, successfully leaking the address of the mm_struct.
Bypassing KASLR with KernelSnitch: A Practical Side-Channel Attack
TLDR: Researchers have developed KernelSnitch, a side-channel attack that exploits timing variations in Linux kernel hash table operations to leak sensitive heap pointers. By manipulating hash bucket occupancy via standard syscalls, an attacker can reliably identify kernel memory addresses and bypass KASLR. This technique provides a powerful primitive for modern kernel exploitation, even on hardened systems.
Kernel Address Space Layout Randomization (KASLR) is the primary line of defense against memory corruption exploits in the Linux kernel. For years, we have relied on the assumption that if we cannot find the base address of the kernel or its heap, we cannot reliably trigger a use-after-free or overflow. KernelSnitch changes that math. By exploiting software-induced timing side channels in kernel hash tables, researchers have demonstrated a reliable way to leak kernel heap pointers in under a minute. This is not a theoretical exercise; it is a direct path to de-randomizing the kernel memory space.
The Mechanics of the Leak
At its core, KernelSnitch exploits the fact that hash table lookups in the Linux kernel are not constant-time operations. When the kernel performs a lookup in a hash table, the time taken depends on the number of elements in the target bucket. If a bucket is empty, the lookup is fast. If it contains multiple elements, the lookup is slower because the kernel must traverse the linked list to find the target.
An unprivileged user can manipulate this behavior by using syscalls that interact with kernel structures, such as the futex subsystem. By calling these syscalls with specific, invalid identifiers, an attacker can force the kernel to iterate through the entire linked list of a hash bucket. By measuring the time taken for these syscalls using high-resolution timers, the attacker can determine the occupancy level of specific buckets.
To make this signal usable, the researchers implemented a clever amplification technique. They perform thousands of measurements for each bucket and take the average of the fastest results. This effectively filters out the noise from interrupts and other system activity. By flushing the CPU caches before each measurement—using a large array access—they ensure that the timing difference between a cache hit and a cache miss is maximized, making the occupancy level of the hash bucket clearly visible.
From Occupancy to Pointer Leakage
The real power of KernelSnitch lies in its ability to turn this occupancy signal into a memory leak. The researchers targeted the futex hash table, which stores kernel metadata for userspace mutexes. When an attacker provides a specific user address, the kernel hashes it to find the corresponding bucket.
Because the hash function is known and the user-supplied identifier is under the attacker's control, the attacker can perform a brute-force search across the kernel's memory space. By testing potential kernel addresses and observing whether they cause a hash collision in the target bucket, the attacker can identify the exact location of sensitive structures like the mm_struct.
The following snippet illustrates the logic of the access primitive used to measure the timing:
// Simplified logic for measuring syscall timing
for (int i = 0; i < iterations; i++) {
flush_cpu_caches();
t0 = get_time();
sys_futex_wait(user_address);
t1 = get_time();
times[i] = t1 - t0;
}
By identifying which addresses result in a hash collision, the attacker effectively maps the kernel's memory layout. Once the mm_struct address is leaked, the attacker has a reliable base for further exploitation, such as overwriting function pointers or manipulating process credentials.
Real-World Applicability
For a pentester or a bug bounty hunter, this technique is a game-changer. On a modern engagement, you often find a memory corruption vulnerability but struggle to turn it into code execution because of KASLR. KernelSnitch provides the missing link. It does not require special privileges or complex hardware-based side channels like Spectre or Meltdown. It works entirely through standard, legitimate syscalls.
This attack is particularly dangerous because it is architecture-agnostic. While the researchers demonstrated it on x86-64, the underlying logic applies to any architecture where the kernel uses similar hash table implementations, including AArch64 and RISC-V. If you are testing a system and need to bypass KASLR, this is a technique you should have in your arsenal.
The Defensive Reality
Defending against this is notoriously difficult. When the researchers disclosed this to the Linux kernel maintainers, the response was blunt: KASLR is fundamentally broken for local attackers. The kernel developers have historically been reluctant to implement heavy mitigations for side channels that rely on local, unprivileged access, as these often introduce significant performance overhead.
The patch proposed by the researchers involved adding a layer of randomization to the hash function by XORing the hash with a secret offset. While this makes the brute-force phase of the attack significantly slower, it does not eliminate the underlying side channel. As long as the kernel performs memory lookups that are sensitive to the state of its internal data structures, timing side channels will remain a viable vector for information disclosure.
If you are auditing a system, do not rely on KASLR to protect your sensitive kernel structures. Assume that a local attacker can de-randomize the address space. Focus your efforts on preventing the initial memory corruption vulnerabilities that allow for privilege escalation. The best defense against a KASLR bypass is to ensure there is no memory corruption to exploit in the first place. Keep your kernel patched, minimize the attack surface by disabling unnecessary features, and monitor for unusual patterns in syscall latency that might indicate an attacker is probing your kernel's memory layout.
Vulnerability Classes
Tools Used
Target Technologies
Attack Techniques
Up Next From This Conference
Similar Talks

Optical Espionage

Cash, Drugs, and Guns: Why Your Safes Aren't Safe




