A newly disclosed Linux kernel vulnerability CVE-2026-31431, nicknamed “Copy Fail” is making waves in the security community. Unlike many privilege escalation bugs that require complex race conditions or crash-prone timing tricks, this one is quiet, portable, and devastatingly simple to trigger.
What Is Copy Fail?
Copy Fail is a logic bug in the Linux kernel’s authencesn cryptographic template. An unprivileged local user can exploit it to perform a controlled 4-byte write into the page cache of any readable file on the system including setuid binaries like /usr/bin/su. A 732-byte Python script is all it takes to get a root shell.
Why Is It So Dangerous?
Most kernel exploits come with caveats. They’re version-specific, require multiple attempts, or risk crashing the system. Copy Fail is different in several keyways:
- It’s portable. The same script works unchanged on Ubuntu, Amazon Linux, RHEL, and SUSE, across kernel versions 6.12 through 6.18. No per-distro offsets, no recompilation required.
- It’s tiny. The entire exploit is a short Python script using only standard library modules. No compiled payloads, no external dependencies.
- It’s stealthy. The write bypasses the normal VFS write path. The kernel never marks the corrupted page as “dirty,” so the on-disk file remains completely unchanged. Standard file integrity tools that check on-disk checksums like Tripwire or AIDE, will see nothing wrong. Only the in-memory page cache is modified, and that’s what the kernel uses when executing files.
- It crosses container boundaries. Because the page cache is shared across all processes on a host including across containers, this bug isn’t just a local privilege escalation. It’s also a container escape vector. (The researchers are publishing a follow-up on Kubernetes exploitation.)
The Technical Root Cause
The bug sits at the intersection of three independent kernel changes made over nearly a decade:
- 2011: authencesn was added to support IPsec Extended Sequence Numbers. It used the caller’s destination scatterlist as scratch space for ESN byte rearrangement — harmless at the time.
- 2015: AF_ALG gained AEAD support, allowing unprivileged userspace to feed data (including page cache pages via splice()) into the kernel crypto subsystem.
- 2017: An optimization made AEAD operations in-place by chaining the tag pages from the source scatterlist directly into the destination scatterlist, and then setting req->src = req->dst.
No single change was dangerous on its own. But together, they created a path where authencesn’s scratch write at offset assoclen + cryptlen walked off the end of the legitimate output buffer and into page cache pages of whatever file was spliced in.
The attacker controls exactly which file is targeted, which 4-byte offset within that file is overwritten, and what value is written. That’s all you need.
The Exploit Flow
The attack against /usr/bin/su (setuid root) works in four straightforward steps:
- Open an AF_ALG socket bound to authencesn(hmac(sha256),cbc(aes)). No special privileges needed.
- For each 4-byte chunk of shellcode, craft a sendmsg() + splice() pair targeting the right file offset.
- Call recv() — the kernel’s decrypt operation fires, writes 4 bytes to the page cache, returns an error. The corruption persists.
- Call execve(“/usr/bin/su”). The kernel loads the binary from the now-corrupted page cache. Shellcode runs as UID 0.
The Fix
The patch reverts algif_aead.c to out-of-place operation, eliminating the 2017 in-place optimization entirely. req->src now points to the TX scatterlist (which may contain page cache pages). req->dst points to the separate RX buffer. The page cache pages never enter the writable destination scatterlist again.
What You Should Do
Patch now. Major distributions are shipping the fix through normal kernel package updates. Apply them.
For immediate mitigation if you can’t patch right away, you can block AF_ALG socket creation via seccomp policy, or disable the algif_aead kernel module:
bash
echo “install algif_aead /bin/false” > /etc/modprobe.d/disable-algif-aead.conf
rmmod algif_aead 2>/dev/null
A Broader Lesson
Copy Fail is a reminder that subtle, latent vulnerabilities can accumulate in large codebases when changes happen across years and teams. Each of the three contributing commits was individually reasonable. The danger only emerged from their combination and it took nearly a decade and AI-assisted research to surface it.
Based on the public disclosure of CVE-2026-31431 by Xint Code Research Team, published April 29, 2026.
HQ/EMEAFind out how we can help your business