
Zero-dependency Python PoC for CVE-2026-31431, Linux kernel LPE via AF_ALG/splice page-cache corruption.
A compact, zero-dependency Python proof-of-concept for Copy Fail (CVE-2026-31431), a Linux kernel local privilege escalation through AF_ALG and splice() that corrupts the page cache of a readable file such as /usr/bin/su.
This is a port of the Theori PoC with two practical changes: the splice() syscall is invoked via ctypes instead of C, making it run on Python 3.7+ with nothing to compile, and the payload spawns a /bin/bash root shell rather than /bin/sh.
| Branch |
|---|
Check yours with uname -r. The exploit targets roughly kernels 4.9 through 6.18; patched distro kernels may be unaffected even within those ranges.
Nothing to install: the exploit uses only the Python standard library. You need read access to the target binary (readable SUID binaries are the usual target) and a vulnerable kernel.
python3 copy_fail_exp.py /usr/bin/su
Expected output on a vulnerable host:
[*] target: /usr/bin/su
[*] AF_ALG socket opened
[*] splicing page cache of target...
[*] page cache corrupted
[*] spawning root shell...
# whoami
root
Real output varies by kernel and timing. If the shell doesn't appear, re-run it; timing-dependent cache corruption sometimes needs a second attempt.
| Requirement | Why |
|---|
Authorized testing and education only. Do not run this on systems you do not own or have explicit permission to test.
| Affected versions |
|---|
| 4.9 | 4.9.x |
| 4.14–4.19 | All stable point releases |
| 5.4–5.15 | All stable point releases |
| 6.1 | 6.1.x |
| 6.6 | 6.6.x |
| 6.12 | 6.12.x (upstream-fixed range) |
| Python 3.7+ | ctypes splice implementation |
| Readable target binary | Cache page to corrupt (e.g., /usr/bin/su) |
| Vulnerable kernel | See the affected-versions table above |
| Local user account | This is a local privilege escalation |