Analysis and Exploitation of a Linux Kernel Vulnerability
A reference count leak in the Linux kernel keyrings facility allows a local user to overflow the usage counter of a keyring object, leading to a use-after-free. An attacker could exploit this to escalate privileges to root.
perception-point.io
Published on perception-point.io
The Perception Point Research team has identified a 0-day local privilege escalation vulnerability in the Linux kernel. While the vulnerability has existed since 2012, our team discovered the vulnerability only recently, disclosed the details to the Kernel security team, and later developed a proof-of-concept exploit.
The full write-up lives on its author's site
It belongs to its author, so we link to it rather than copy it. The other two tabs are our own rewrites, checked against it.
Not written yet. The AI write-up for this write-up has not been written yet. The Original tab links to the source.
How it worked
Root cause
Likely a missing call to key_put on an error path when joining the same session keyring, causing a reference leak that can overflow the 32-bit usage counter.
Impact
A local user could escalate privileges to root; SMEP, SMAP, and SELinux may make exploitation more difficult.
What the attacker needed
Local user access; kernel version 3.8 or higher
The fix
The vulnerability was fixed by the kernel security team.
How it was found
- Hold a legitimate reference to a key object.
- Overflow the same object's usage counter by repeatedly joining the same session keyring.
- Get the keyring object freed by the garbage collector.
- Allocate a different kernel object with user-controlled content over the freed memory.
- Use the reference to the old key object to trigger code execution.
Explained by bugbounty.wiki with AI from the original and checked against quotes from it; it can still be wrong. Read the original before relying on a detail.
Not written yet. The AI write-up for this write-up has not been written yet. The Original tab links to the source.
The Linux kernel keeps track of how many references exist to certain objects using a counter. A bug caused this counter to be increased without a matching decrease, so it could be made to wrap around to zero. That let an attacker free the object while still holding a reference, and then reuse the freed memory to run their own code with high privileges.
What is Memory corruption?
Native code reads or writes memory it should not: overflows, use-after-free, type confusion. The core of browser, kernel and parser bugs.