## https://sploitus.com/exploit?id=KITPLOIT:TOOLS-GITHUB-0XFUFFM3-CVE-2026-31431-COPYFAIL
root@kitploit:~
βββββββ βββββββ βββββββ βββ βββ ββββββββ ββββββ ββββββ
βββββββββββββββββββββββββββββ ββββ ββββββββββββββββββββββ
βββ βββ βββββββββββ βββββββ ββββββ ββββββββββββββ
βββ βββ ββββββββββ βββββ ββββββ ββββββββββββββ
ββββββββββββββββββββ βββ βββ βββ ββββββββββββββ
βββββββ βββββββ βββ βββ βββ βββ ββββββββββββββ
# CVE-2026-31431 β "Copy Fail"
### Linux Kernel Local Privilege Escalation via `algif_aead` Page Cache Corruption
  -yellow?style=for-the-badge&logo=linux&logoColor=black)  
> **β οΈ AUTHORIZED USE ONLY** β This repository is strictly for penetration testers, security researchers, and defenders operating under lawful authorization. Misuse is a criminal offense.
* * *
## π Table of Contents
* * *
## π What is Copy Fail?
**Copy Fail** is a **local privilege escalation (LPE)** vulnerability disclosed on **April 29, 2026** , affecting virtually every major Linux distribution running kernels since **2017**.
root@kitploit:~
Unprivileged User βββΊ AF_ALG + splice() βββΊ 4-byte Page Cache Write βββΊ ROOT
### Key Facts at a Glance
### Why This Is Dangerous
* π΅οΈ **Stealthy** β Modification lives only in the page cache; the file on disk is **never changed**. Standard disk forensics will not detect it.
* β‘ **Reliable** β Deterministic logic flaw, not a race condition. Exploitation is consistent across environments.
* π **Universal** β Affects Ubuntu, RHEL, Amazon Linux, SUSE, Debian β every major distro since 2017.
* βΈοΈ **Cloud/K8s Impact** β Can facilitate container escape in Kubernetes workloads and CI/CD runners.
* π€ **AI-Discovered** β Found by Xint Code's AI system with ~1 hour of scan time and a single operator prompt.
* * *
## π¬ Technical Deep Dive
### Root Cause
The vulnerability stems from a **buggy in-place optimization** introduced in 2017 (`commit 72548b093ee3`) inside the `algif_aead` module of the Linux kernel's userspace crypto API (`AF_ALG`).
root@kitploit:~
AF_ALG (userspace crypto API)
βββ algif_aead module
βββ authencesn template βββ VULNERABLE
βββ in-place optimization (2017)
βββ req->src == req->dst βββ pages from splice() chained into writable dst scatterlist
### Attack Flow
root@kitploit:~
Step 1: Open AF_ALG AEAD socket
socket(AF_ALG, SOCK_SEQPACKET, 0)
Step 2: Send splice() pages referencing target file
(page cache pages of a privileged binary, e.g. /usr/bin/sudo)
Step 3: Trigger authencesn scratch write
authencesn uses dst buffer as scratch pad β
writes 4 controlled bytes PAST the legitimate output region
Step 4: Page cache entry for the target file is now corrupted
(disk file untouched β only in-memory copy modified)
Step 5: Execute the modified binary β ROOT
### Why the Page Cache?
The Linux kernel's page cache backs in-memory copies of files. When a file is read, its pages are cached. The `splice()` syscall can reference these cached pages directly. By feeding page cache pages into the AF_ALG AEAD scatterlist, the authencesn scratch write lands **inside those cached pages** , effectively patching the in-memory copy of any readable file β including privileged binaries like `sudo`, `pkexec`, or `passwd`.
### The Fix
The upstream fix reverts the flawed 2017 optimization:
root@kitploit:~
# Fixed in commit: a664bf3d603d
git show a664bf3d603d
* * *
## π₯οΈ Affected Systems
### Linux Kernel Versions
### Distribution Matrix
* * *
## π Repository Structure
root@kitploit:~
CVE-2026-31431-CopyFail/
β
βββ π README.md β You are here
βββ π LICENSE β Research/Educational license
βββ π DISCLAIMER.md β Legal & ethical use policy
βββ π CHANGELOG.md β Version history
β
βββ π docs/
β βββ vulnerability-analysis.md β Deep-dive: root cause & mechanics
β βββ exploitation-walkthrough.md β Step-by-step methodology
β βββ affected-kernels.md β Full kernel/distro version matrix
β βββ detection.md β Defender, Tenable, Wazuh coverage
β βββ references.md β All CVEs, blogs, advisories
β
βββ π exploit/
β βββ README.md β Usage, prerequisites, tested distros
β βββ copyfail.py β Reference PoC (educational)
β βββ trigger.c β AF_ALG + splice() C trigger
β βββ variants/
β βββ ubuntu.py β Ubuntu-specific variant
β βββ rhel.py β RHEL/CentOS variant
β βββ amazon_linux.py β Amazon Linux variant
β
βββ π detection/
β βββ yara/
β β βββ copyfail.yar β YARA rule for exploit artefacts
β βββ sigma/
β β βββ copyfail_lpe.yml β Sigma rule for SIEM/SOC
β βββ scripts/
β βββ check_vulnerable.sh β Quick kernel vulnerability check
β βββ detect_algif_aead.sh β Check if module is loaded/active
β
βββ π mitigation/
β βββ README.md β Mitigation overview
β βββ disable_algif_aead.sh β Disable affected kernel module
β βββ patch-notes.md β Upstream patch details
β βββ kubernetes-hardening.md β K8s / container hardening
β
βββ π lab/
β βββ Vagrantfile β Reproducible vulnerable VM
β βββ setup.sh β Lab bootstrap script
β βββ docker/
β βββ Dockerfile β Vulnerable Ubuntu container
β
βββ π reports/
β βββ pentest-report-template.md β Client-ready report template
β βββ sample-finding.md β Sample finding write-up
β
βββ π assets/
βββ demo.gif β (Optional) terminal demo
βββ diagrams/
βββ page-cache-write.png β Attack flow diagram
* * *
## π§ͺ Lab Setup
> **Always test in an isolated, authorized environment. Never run exploits on production systems.**
### Option A β Vagrant VM (Recommended)
root@kitploit:~
# Clone the repository
git clone https://github.com/0xFuffM3/CVE-2026-31431-CopyFail.git
cd CVE-2026-31431-CopyFail
# Start the vulnerable lab VM
cd lab/
vagrant up
# SSH into the lab
vagrant ssh
# Verify kernel version (should be vulnerable)
uname -r
### Option B β Docker Container
root@kitploit:~
cd lab/docker/
# Build vulnerable container image
docker build -t copyfail-lab .
# Run with required privileges for kernel interaction
docker run --rm -it --privileged copyfail-lab /bin/bash
### Check If Your System Is Vulnerable
root@kitploit:~
# Run the quick check script
chmod +x detection/scripts/check_vulnerable.sh
./detection/scripts/check_vulnerable.sh
Expected output on a **vulnerable** system:
root@kitploit:~
[!] Kernel version: 5.15.0-91-generic
[!] algif_aead module: LOADED
[β] System appears VULNERABLE to CVE-2026-31431 (Copy Fail)
[*] Recommended action: Apply kernel update or disable algif_aead
Expected output on a **patched** system:
root@kitploit:~
[β] Kernel version: 6.1.132
[β] System appears PATCHED against CVE-2026-31431 (Copy Fail)
* * *
## π₯ Exploit Usage
> **Requires:** Local access as an unprivileged user on a vulnerable system.
### Prerequisites
root@kitploit:~
# Python 3.6+
python3 --version
# Required kernel modules present
lsmod | grep algif_aead
# Verify the target binary is readable
ls -la /usr/bin/sudo
### Running the PoC
root@kitploit:~
cd exploit/
# Check current privilege level
id
# uid=1000(user) gid=1000(user) groups=1000(user)
# Run Copy Fail PoC
python3 copyfail.py
# Verify privilege escalation
id
# uid=0(root) gid=0(root) groups=0(root)
### Pentest Workflow
root@kitploit:~
1. Enumerate kernel version
βββΊ uname -r / cat /proc/version
2. Check if algif_aead is loaded
βββΊ lsmod | grep algif_aead
3. Confirm low-privilege foothold
βββΊ id / whoami
4. Execute Copy Fail PoC
βββΊ python3 exploit/copyfail.py
5. Verify root access
βββΊ id && cat /etc/shadow
6. Document evidence
βββΊ Screenshot + log kernel version, distro, exploit hash
7. Apply mitigation (post-test)
βββΊ sudo bash mitigation/disable_algif_aead.sh
8. Include in pentest report
βββΊ Use reports/pentest-report-template.md
* * *
## π Detection
### YARA Rule
root@kitploit:~
// detection/yara/copyfail.yar
rule CopyFail_CVE_2026_31431 {
meta:
description = "Detects Copy Fail (CVE-2026-31431) exploit artefacts"
author = "0xFuffM3"
date = "2026-04-30"
reference = "https://copy.fail"
strings:
$py1 = "algif_aead" ascii
$py2 = "AF_ALG" ascii
$py3 = "splice" ascii
$py4 = "page_cache" ascii
$py5 = "authencesn" ascii
condition:
3 of them
}
Run YARA scan:
root@kitploit:~
yara detection/yara/copyfail.yar /tmp/ -r
### Sigma Rule (SIEM)
root@kitploit:~
# detection/sigma/copyfail_lpe.yml
title: Copy Fail LPE Exploit Execution (CVE-2026-31431)
status: stable
logsource:
category: process_creation
product: linux
detection:
selection:
CommandLine|contains:
- 'AF_ALG'
- 'algif_aead'
- 'authencesn'
condition: selection
falsepositives:
- Legitimate crypto API testing
level: high
### Quick Detection Script
root@kitploit:~
chmod +x detection/scripts/detect_algif_aead.sh
./detection/scripts/detect_algif_aead.sh
### Security Tool Coverage
* * *
## π‘οΈ Mitigation
### Option 1 β Apply Kernel Patch (Recommended)
root@kitploit:~
# Ubuntu / Debian
sudo apt-get update && sudo apt-get upgrade linux-image-generic
# RHEL / CentOS
sudo yum update kernel
# Amazon Linux
sudo yum update kernel
# After update, reboot
sudo reboot
### Option 2 β Disable `algif_aead` Module (Interim)
root@kitploit:~
# Run the mitigation script
chmod +x mitigation/disable_algif_aead.sh
sudo bash mitigation/disable_algif_aead.sh
What the script does:
root@kitploit:~
echo "install algif_aead /bin/false" > /etc/modprobe.d/disable-algif.conf
rmmod algif_aead 2>/dev/null || echo "[*] Module not currently loaded"
echo "[β] algif_aead disabled. Reboot to confirm persistence."
### Option 3 β Kubernetes Hardening
See `mitigation/kubernetes-hardening.md` for:
* Restricting `AF_ALG` socket creation in pod security policies
* Seccomp profile to block `socket(AF_ALG, ...)` syscall
* Priority patching for Kubernetes nodes and CI/CD runners
* * *
## π Pentest Reporting
A ready-to-use client report template is in `reports/pentest-report-template.md`.
### Sample Finding Summary
root@kitploit:~
Finding: Local Privilege Escalation via Copy Fail (CVE-2026-31431)
Severity: HIGH (CVSS 7.8)
Host: 10.10.10.55 (ubuntu-prod-01)
Kernel: 5.15.0-91-generic
Evidence:
- Unprivileged shell (uid=1000) escalated to root (uid=0)
- Kernel module algif_aead confirmed loaded
- No disk artefacts β page cache only
Recommendation:
1. Apply vendor kernel patch immediately
2. Interim: disable algif_aead module
3. Review Kubernetes nodes and CI/CD runners
* * *
## βοΈ Legal & Ethics
> **Read before using anything in this repository.**
This repository is published for **legitimate security research, authorized penetration testing, and defensive security** purposes only.
* β
**Allowed:** Testing on systems you own or have explicit written authorization to test
* β
**Allowed:** Security research in isolated lab environments
* β
**Allowed:** Defensive use β detection, patching, hardening
* β **Prohibited:** Testing on systems without written authorization
* β **Prohibited:** Deploying exploits against production systems
* β **Prohibited:** Any use that violates local, national, or international law
Unauthorized use of this material may violate the **Computer Fraud and Abuse Act (CFAA)** , **EU Directive 2013/40/EU** , **Indian IT Act 2000** , and equivalent laws in your jurisdiction.
The authors assume **no liability** for misuse. See `DISCLAIMER.md` for the full legal notice.
* * *
## π References
* * *
## π€ Contributing
Security researchers are welcome to contribute:
1. Fork the repository
2. Create a feature branch: `git checkout -b feat/your-contribution`
3. Commit your changes: `git commit -m "Add: detection rule for X"`
4. Push and open a Pull Request
Please follow responsible disclosure norms. Do not include weaponized, production-ready exploit code targeting patched systems.
* * *
**Made for the security community β use responsibly.**
