Skip to content
Memory corruption Write-up Advanced

Breaking Down CVE-2026–31431 (“Copy Fail”): What You Need t

A kernel crypto optimisation from 2017 lets an unprivileged user corrupt the in-memory page cache of a setuid binary such as su by splicing the file into an AF_ALG socket. The attacker can then flip a privilege check so that running su yields a root shell, while the on-disk file stays unchanged.

mainekhacker Follow

Published on mainekhacker.medium.com

Imagine a library. Books on shelves = files on your Linux system.

MainEkHacker, on mainekhacker.medium.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 an in-place optimisation in the kernel's authencesn crypto path causes scratch output to be written into page-cache pages that were spliced in as input, because input and output share one buffer.

Impact

Any local user could gain root, and because containers share the host page cache, a compromised container could put the whole host at risk until reboot.

What the attacker needed

Local unprivileged access; unpatched kernel with AF_ALG; target setuid binary in page cache

The fix

The patch reverts the 2017 in-place optimisation so input and output use separate buffers; as a workaround, blacklist the algif_aead kernel module until the kernel is updated.

How it was found

  1. Open an AF_ALG crypto socket as an unprivileged user.
  2. Splice the target setuid binary into the socket so its page-cache pages become part of the crypto buffer.
  3. Choose the input size so the authencesn scratch write lands on the bytes to change.
  4. Run the modified program to 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.

Linux keeps a fast in-memory copy of files it reads, called the page cache, and runs programs from that copy rather than from disk. A mistake in the kernel's crypto code lets a normal user write four bytes into that in-memory copy of a privileged program. Changing those bytes can turn a 'are you root?' check into 'always yes', so the next person who runs the program gets a root shell.

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 mainekhacker

View all

2 more disclosed reports, 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.