A reference counting bug which leads to local privilege escalation in io_uring
The io_uring subsystem passed a reference to the caller's files_struct to a kernel worker without incrementing its reference counter, so the structure could be freed while the worker still used it. An attacker who already has code execution could exploit this use-after-free to escalate privileges to root.
flattsecurity.medium.com
Published on flattsecurity.medium.com
Hello, I’m Shiga( @Garyo ), a security engineer at Flatt Security Inc.
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 reference count increment when io_uring handed the caller's files_struct to an async worker, creating a use-after-free.
Impact
An attacker with arbitrary code execution in the system could escalate privileges to root.
What the attacker needed
Arbitrary code execution on the system
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 has a feature called io_uring that lets programs hand slow input/output work to background kernel threads. Those threads need to know which files the program has open, and the kernel keeps a count of how many things are using that file table so it is not thrown away too early. Here the count was not increased, so the table could be freed and reused while a background thread still pointed at it, letting someone who can already run code on the machine become root.
What is Race condition?
Parallel requests reach a state the code assumed could not happen: a coupon used twice, a limit overrun, a check skipped.