One add_key puts a shortcut node directly behind another shortcut node in a keyring's associative array, which the tree treats as impossible. It BUG()s and kills the inserting thread, but a reader parked in key_link walks the broken tree anyway and lands on an attacker-owned object it believes is a struct key . The kernel's own key-quota accounting then writes through an aliased pointer into cred->cap_effective .
I did not find this bug. There's a public patch for it, 48691075b0ad , authored by Linus Torvalds, crediting Nils Ollrogge as the reporter. It hasn't landed in mainline though: torvalds/linux master still has excised_meta[1] where the patch makes it [2] , checked 2026-11-15. The exploit chain is the only part I wrote. It was already public before I could use it, and I'd have gotten smoked in kernelCTF with it anyway.
lib/assoc_array.c is the kernel's RCU-safe radix tree, used almost entirely by the keyrings code. It has nodes (16-slot fan-out levels) and shortcuts, which compress a single-occupant subtree into one hop and store the skipped index bits inline. A shortcut's parent is always a node, never another shortcut, because the first would have absorbed the second's bits.
Deletion can leave a plain node below a shortcut. Insertion can then replace that node with a shortcut, when the node's leaves and the new key all agree on its segment and there is nothing left to split on. If that node was already a shortcut's target, the new shortcut is installed as the old one's node. The fix commit gives the recipe: "sixteen keys that agree on bits 0-11, one that leaves them at bit 8 and is deleted again, and one more that agrees with the sixteen."
Two things then go wrong, and the exploit needs both. assoc_array_walk() indexes the second shortcut as a node , so a reader mis-parses the skipped bits and follows a pointer from the wrong level of the tree. And assoc_array_apply_edit() hits its BUG_ON() on that same insertion:
The oops takes down only the inserting thread. The chain arranges for a reader to be parked in key_link at exactly that moment, and it survives.
The reader treats an attacker-owned allocation as a struct key . The chain places it so the fake key's user pointer sits eight bytes below a real struct cred :
0xfffffe968c0436c0 - 8 == 0xfffffe968c0436b8 . struct key_user holds the per-UID quota counters, and every key instantiation adjusts them through key->user . Aliased into a credential, those adjustments land in the capability words instead. That is the whole write primitive: the kernel's own bookkeeping, at an eight-byte offset.
It is a capability escalation, not a uid one. uid stays 1000 and CapEff goes from 0000000000000000 to 00000000ffffffff : the low 32 bits, the width of the aliased counter. CAP_DAC_OVERRIDE is in there, so a root-only file becomes readable.
Getting a shell is a second step: holding CAP_SETUID , call setresuid(0,0,0) and execve . The kernel sees an execve by euid 0 and grants the full set legitimately, which is why the recording shows 00000000ffffffff from the gadget and then 000001ffffffffff in the shell. The first one is the bug. The second is just what the kernel hands any euid 0 process on execve.
1:47. Also in demo/ .
Root shell at 84 s on that take. Screen recording competes for the VM's two vCPUs, so it is slower than the times below.
Both on the same hardened image, 2 vCPU. The root-shell build needs K2_AFALG_TIMEOUT_USEC=2000000 ; at the compiled-in 500 ms it manages 2/8, because the cred-capture stage does 1800 open / close and a 20 ms sleep inside a per-sample budget sized for a stage that does 448 keyctl updates and sleeps 1 ms.
The remaining failures are the race itself. The target key's allocation rank has to land above 352 of 640 prepared workers, and a rank below that is terminal for the run.
The prebuilt binary is the tested one. Running the full chain needs the matching hardened image and a kernelCTF-style initramfs, neither of which is here.
Bug reported by Nils Ollrogge , fixed by Linus Torvalds , reviewed by David Howells
assoc_array_insert_into_terminal_node() has been here twice before: CVE-2016-7914 and CVE-2017-12193 . This is the third bug in that function.
Lab artifact, built against one pinned kernel image in a VM. Run it on systems you own. If you defend Linux boxes: patch past 48691075b0ad , and restricting unprivileged AF_ALG removes the heap oracle this chain needs.
Disclaimer: This exploit code is provided for security research and educational purposes. Do not use it against systems you do not own or have explicit authorization to test. The author is not responsible for misuse.
Disclaimer: This exploit code is provided for security research and educational purposes. Do not use it against systems you do not own or have explicit authorization to test. The author is not responsible for misuse.
Daniel Wade - GitHub · Twitter/X · Bluesky · Mastodon · Medium · nadsec.online
The full story
This article is one source in a clustered incident — the cluster page carries the summary, timeline and every other outlet covering it.
