Skip to content
Memory corruption Write-up Advanced

The Invisible Hack: How a Linux Bug Lets Anyone Become Root — Without Leaving a Single Trace

A Linux kernel cryptography module writes attacker-controlled data into the page cache instead of a safe buffer, letting an unprivileged local user overwrite a setuid binary in memory. The attacker can then run that binary to gain root without changing anything on disk or leaving logs.

Krish Gupta Follow

Published on infosecwriteups.com

Imagine you hire a security guard for your house. You hand him a rulebook.

Krish Gupta, on infosecwriteups.com

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 pointer miscalculation in the kernel's algif_aead module causes a memory copy to target the page cache instead of the intended safe output buffer.

Impact

Any local user could gain root, and because the change is only in RAM it may be forensically undetectable after a reboot; the shared page cache could also let a container attacker compromise the host.

What the attacker needed

Local unprivileged access; vulnerable kernel version; ability to open AF_ALG sockets

The fix

The text recommends updating the kernel to a patched version, or disabling the algif_aead module if updating is not possible.

How it was found

  1. Confirm you are a normal unprivileged user and the kernel version is vulnerable.
  2. Read the target setuid binary into the page cache.
  3. Disassemble the binary to find the offset of the conditional jump in the password check.
  4. Open a socket to the kernel crypto interface and set a key.
  5. Send a two-byte payload that replaces the jump with no-operation instructions.
  6. Run the setuid binary and supply any password to obtain root.

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.

Linux keeps a copy of files it has read in memory (the page cache) so programs run faster. A bug in a kernel encryption module lets a normal user write into that memory copy of a privileged program, changing its behaviour without touching the file on disk. The user can then run that program to become the administrator (root).

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.

More by Krish Gupta

View all

1 more disclosed report, best first.

Similar reports

View all

Same bug class and techniques, clearest first.

Memory corruption

The lesson behind this report.

Native code reads or writes memory it should not: overflows, use-after-free, type confusion. The core of browser, kernel and parser bugs.