Skip to content
Memory corruption Write-up Advanced

CVE-2026-31431: “Copy Fail” Linux kernel flaw lets local users gain root in seconds

A flaw in the Linux kernel's AF_ALG crypto interface allows an unprivileged local user to corrupt the page cache of setuid binaries, such as /usr/bin/su, and gain root access. The corruption occurs because a four-byte write intended for scratch space ends up in the cached file data, bypassing file permissions.

webflow.sysdig.com

Published on webflow.sysdig.com

linkedin

The author, on webflow.sysdig.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 the 2017 in-place optimisation in algif_aead causes the output scatterlist to include page cache pages from a spliced file, so a four-byte scratch write by the authencesn algorithm lands in the file's cached data instead of a safe buffer.

Impact

Any local unprivileged user on a vulnerable kernel can gain root access, but the attacker needs prior code execution on the machine; there is no remote vector.

What the attacker needed

Local unprivileged access; vulnerable kernel version

How it was found

  1. Bind an AF_ALG socket to the authencesn(hmac(sha256),cbc(aes)) algorithm.
  2. Use splice() to feed page cache pages of /usr/bin/su into the crypto pipeline.
  3. Issue a recvmsg() with AAD bytes 4–7 supplying the four-byte value to be written.
  4. Repeat the primitive at successive offsets to stage shellcode into the cached pages of /usr/bin/su.
  5. Run su to execute the patched binary and obtain a root shell.

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.

This is a local privilege escalation bug in the Linux kernel. A normal user can run a small program that tricks the kernel into writing a few bytes into the memory cache of a privileged program like 'su'. By repeating this, they can change 'su' so that running it gives them a root shell, without needing any special permissions.

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.

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.