
CVE-2026-31431-CopyFail---Minified-LPE-PoC
⚠️ Disclaimer For Educational and Authorized Security Testing Purposes Only. This Proof-of-Concept (PoC) was synthesized for authorized Red Team emulation and vulnerability auditing. The authors and contributors assume no liability for the misuse of this code. Do not use this exploit against systems you do not own or do not have explicit, written permission to test.
📝 Overview CVE-2026-31431 (colloquially known as "Copy Fail") is a Local Privilege Escalation (LPE) vulnerability in the Linux Kernel's Cryptographic API (AF_ALG). By combining an AF_ALG socket with the splice() system call, an unprivileged user can force the kernel to write arbitrary bytes directly into the in-memory page cache of a read-only file. This specific implementation is highly minified (18 lines), making it ideal for Red Team operations where an attacker has a restricted shell, lacks file upload capabilities, and must type the exploit manually via python3 interactive mode.
⚙️ Exploit Strategy Instead of attempting to inject complex ELF shellcode into a setuid binary (which often crashes due to padding and header constraints), this script targets /etc/passwd.
🚀 Pre-Requisites The vulnerable crypto modules must be loaded in the kernel for this exploit to function: sudo modprobe algif_aead authencesn
🎯 Execution & Verification
🧹 Cleanup / Remediation This exploit only alters the system's volatile memory. To revert the system to its secure state and restore the proper UID mapping without rebooting, evict the corrupted page from the cache:
echo 3 > /proc/sys/vm/drop_caches