What Is CVE-2026-31431 "Copy Fail"?
On April 29, 2026, researchers at Theori's Xint Code team disclosed CVE-2026-31431, a local privilege escalation (LPE) vulnerability in the Linux kernel. Within 72 hours, CISA added it to the Known Exploited Vulnerabilities (KEV) catalog — confirming active in-the-wild exploitation — and issued a mandatory remediation deadline of May 15, 2026 for all Federal Civilian Executive Branch (FCEB) agencies. Microsoft, Kaspersky, Sysdig, and SafeBreach each published independent threat intelligence reports documenting exploitation activity targeting cloud-hosted Linux environments.
The vulnerability is named "Copy Fail" by its discoverers. What earns it that name — and what makes it exceptional among kernel LPEs — is the nature of its exploit. The public working PoC is a 732-byte Python script. No kernel offsets. No heap spray. No race condition to win. No per-distribution tuning. The same script, unmodified, drops a root shell on Ubuntu 22.04, RHEL 9, Amazon Linux 2023, Debian 12, and every other major distribution that has shipped a kernel built since 2017.
The root cause is a nine-year-old logic flaw in the kernel's AEAD crypto socket interface: a 2017 performance optimization that made source and destination memory alias each other during decryption. An attacker feeds page-cache-backed pages (the kernel's live in-memory copy of a file) into that buffer via splice(). Because of the aliasing, those pages become both the input and the output. A composite crypto template then performs a deterministic 4-byte write into those pages as scratch space — corrupting the in-memory content of the target file. By repeating that write, the attacker rewrites a SUID binary in memory, then executes it to obtain root. The on-disk file is never touched.
CVSS v3.1 scores this at 7.8 (High). Given its reliability, universal distribution coverage, and confirmed in-the-wild exploitation, most security teams are treating it as critical-severity in their response workflows.
This article is the most complete technical analysis of Copy Fail published to date: root cause in algif_aead.c, full attack chain step by step, PoC dissection, affected kernel versions per distribution, container-specific risks, detection indicators with exact auditd rules, and per-distribution remediation commands.
Root Cause: A 2017 Performance Optimization Gone Wrong
The vulnerability lives in crypto/algif_aead.c, the kernel module that implements the AF_ALG AEAD socket interface. AF_ALG is a userspace-accessible API that lets unprivileged processes call the kernel's cryptographic primitives directly through a POSIX socket: socket(AF_ALG, SOCK_SEQPACKET, 0). No special privileges are required to open one. It is available on every Linux system where the algif_aead module is loaded — which, on most distributions, is the default.
In 2017, commit 72548b093ee3 introduced an in-place optimization for AEAD decryption operations. Rather than allocating a separate output buffer, the patch set source and destination scatterlists to the same memory. In simplified form: req->src = req->dst. The intent was legitimate — avoiding a memory copy on the hot path of bulk AEAD decryption reduces latency for high-throughput crypto workloads.
The flaw arises when the source scatterlist is backed by page-cache pages — the kernel's in-memory representation of files on disk. An attacker can arrange this using splice(), which can move file-backed pages from a file descriptor into a pipe, and from the pipe into the input buffer of an AF_ALG socket. The attacker opens a readable SUID binary (world-readable by definition), causing the kernel to load its pages into the page cache. Those pages are then spliced into the AF_ALG socket input. Because of the 2017 aliasing, they simultaneously become the destination.
The composite crypto template authencesn(hmac(sha256),cbc(aes)) is where the actual write happens. This template handles AEAD with Extended Sequence Numbers (ESN), a mode in which authentication covers a 64-bit sequence number split across two 32-bit fields. Before computing the HMAC, the template rearranges those two words in place. It writes the high-word of the ESN at offset assoclen + cryptlen within the destination scatterlist — a deterministic 4-byte write directly into a page-cache page.
Authentication then fails: the ciphertext is garbage, and the kernel returns -EBADMSG to the caller. But the write already happened. The kernel does not roll back page-cache modifications on decryption failure. The attacker now has 4 bytes of controlled data at a chosen offset within the target file's in-memory content. They repeat the operation with an incremented offset and new payload bytes, 4 bytes per call, until the entire binary has been overwritten in memory.
This is not a race condition. There is no timing window, no parallel thread to race against, no heap layout to massage. It is a straightforward logic flaw — an aliasing error in a nine-year-old optimization — that produces a reliable write primitive with zero tuning per target.
The upstream fix, commit a664bf3d603d, simply reverts algif_aead.c to out-of-place operation, restoring separate source and destination buffers. The 2017 optimization is removed entirely.

Scope: Every Major Linux Distribution Since 2017
Commit 72548b093ee3 was merged into the Linux kernel mainline in 2017 and was subsequently backported to the stable kernel series. It shipped in every major Linux distribution that has released a kernel update in the past nine years. Any system running a kernel in the range of approximately 4.14 through the fixed versions (6.18.22, 6.19.12, and 7.0) with the algif_aead module loaded is vulnerable.
The following table lists major affected platforms. All of these distributions have released updated kernels addressing Copy Fail as of early May 2026. Check your distribution's security bulletin for the exact package version.
| Distribution | Affected Kernel Series | Patch Advisory |
|---|---|---|
| Ubuntu 20.04 LTS (Focal Fossa) | linux 5.4.x | Ubuntu Security Notice (USN) |
| Ubuntu 22.04 LTS (Jammy Jellyfish) | linux 5.15.x | Ubuntu Security Notice (USN) |
| Ubuntu 24.04 LTS (Noble Numbat) | linux 6.8.x | Ubuntu Security Notice (USN) |
| RHEL / CentOS Stream 8 | kernel 4.18.x | Red Hat Security Advisory (RHSA-2026) |
| RHEL / CentOS Stream 9 | kernel 5.14.x | Red Hat Security Advisory (RHSA-2026) |
| RHEL 10.1 | kernel 6.11.x | Red Hat Security Advisory (RHSA-2026) |
| Amazon Linux 2023 | kernel 6.1.x | Amazon Linux Security Advisory (ALAS2023) |
| Debian 12 (Bookworm) | linux 6.1.x | Debian Security Advisory (DSA) |
| SUSE Linux Enterprise 15 | kernel 5.14.x / 6.4.x | SUSE Security Update (SUSE-SU-2026) |
| Fedora 41 / 42 | kernels through 6.12.x | Fedora Security Update |
| AlmaLinux / Rocky Linux 9 | kernel 5.14.x | ALSA / RLSA advisory |
| CloudLinux OS 9 | kernel 5.14.x | CloudLinux Security Advisory |
The Attack Chain: Step by Step
Understanding the full attack chain is essential for building accurate detection rules and for assessing your actual exposure. Here is the complete sequence from unprivileged shell to root.
Step 1 — Identify the target SUID binary. The attacker selects a SUID root binary that is small enough to overwrite in a reasonable time. /usr/bin/su is the canonical target in the PoC: it is world-readable, typically under 200 KB, and executing it post-modification runs the payload as root. Other viable targets include /usr/bin/newgrp, /usr/bin/passwd, and any custom SUID binary present on the system.
Step 2 — Load the target into the page cache. The attacker opens the SUID binary for reading using a standard open() call — no elevated permissions required for a world-readable file. This causes the kernel to load the file's pages into the page cache, making them available as page-cache-backed memory.
Step 3 — Set up an AF_ALG AEAD socket pair. The attacker opens a socket with socket(AF_ALG, SOCK_SEQPACKET, 0) and binds it to the algorithm descriptor for authencesn(hmac(sha256),cbc(aes)). A dummy 32-byte key is set via setsockopt(). The socket is then accept()-ed to produce the connected child socket used for the actual crypto operations.
Step 4 — Splice the target's page-cache pages into the socket input. Using splice() (typically through a pipe as an intermediary), the attacker moves pages from the open file descriptor of the target binary into the AF_ALG socket's input buffer. These are the live page-cache pages — the kernel's in-memory copy of the SUID binary. Because of the 2017 in-place aliasing, the same pages are also the destination.
Step 5 — Trigger the 4-byte write at the desired offset. The attacker calls sendmsg() on the child socket with a crafted control message specifying ALG_OP_DECRYPT and setting assoclen such that the ESN rearrangement write lands at the target offset within the file. The kernel writes 4 attacker-controlled bytes, then returns -EBADMSG. The write has occurred.
Step 6 — Repeat for every 4-byte block of the payload. The attacker increments the offset by 4 and repeats step 5, placing the next 4 bytes of the malicious payload. For a typical small SUID binary, this completes in a few seconds. The on-disk binary is untouched; only the page-cache content has changed.
Step 7 — Execute the overwritten binary for root. The attacker calls execve("/usr/bin/su", NULL, NULL). The kernel serves the in-memory (modified) version of the binary to the new process. The payload runs with SUID root privileges. A root shell is obtained.
The entire exploit from launch to interactive root shell completes in under 10 seconds on a modern system. The 732-byte PoC automates steps 2 through 7 in a single script run.
Proof of Concept: Dissecting the 732-Byte Script
The public PoC released by Theori — and the several C ports that followed within days of disclosure — is remarkable for its simplicity. Understanding its structure is directly useful for building precise behavioral detection rules.
The script constructs the AF_ALG socket pair using only standard POSIX calls available to any unprivileged process: socket(), bind(), setsockopt(), accept(), open(), pipe(), splice(), and sendmsg(). There is no kernel version detection, no memory layout enumeration, no KASLR bypass, and no heap grooming. The algorithm string authencesn(hmac(sha256),cbc(aes)) is hardcoded because the ESN high-word write is a deterministic, documented property of that specific composite template.
The core of the exploit is the assoclen parameter. In an AEAD sendmsg() call, assoclen specifies the length of the associated data prefix — and directly controls where the ESN write lands within the scatterlist. By iterating assoclen in steps of 4 from 0 to len(payload) - 4, the script sweeps across the entire file and writes 4 bytes of payload per iteration. The dummy ciphertext (a 32-byte HMAC-SHA256 tag region plus an AES-CBC block) is of fixed length and irrelevant in content — authentication always fails, but the write always succeeds first.
The script's universality is a direct consequence of the fact that it exploits a kernel behavior, not a userspace object. There are no distribution-specific addresses, no offset tables, and no libc dependency. The only variable input is the path to the target SUID binary, which the script hardcodes as /usr/bin/su.
Community C ports (tgies/copy-fail-c and pyroceper/copy-fail-CVE-2026-31431) wrap the same logic with a loop that handles alignment and produces a standalone compiled binary — useful for environments where Python is not available. Several of these ports generalize the target path as a command-line argument.
The key takeaway for defenders: the exploit generates zero network traffic. It requires no external connectivity, no DNS lookups, and no remote stage retrieval. An attacker with any local shell access — a compromised web application, a low-privilege SSH session, a container foothold — can escalate to root entirely offline, with no outbound indicator for network-based detection tools to catch.
filescanner.online
Scan Any File — Privately.
Deep binary analysis, YARA rules, AI summary, and PDF reports. Up to 2 GB. No account required.
Container and Cloud Environments: Elevated Risk by Default
Copy Fail's impact extends significantly beyond traditional bare-metal Linux hosts. Multiple cloud and container security firms — including Kaspersky, Sysdig, and SafeBreach — have specifically highlighted the elevated risk to containerized environments, and it is worth understanding exactly why.
Docker and LXC containers share the host kernel. The AF_ALG socket family and the algif_aead module are accessible inside containers by default if the module is loaded on the host — and on most hosts it is, because legitimate applications (VPN clients, disk encryption tools, TLS libraries using kernel crypto offload) trigger its autoload. A process inside a container that successfully exploits Copy Fail is writing into the host kernel's page cache, not the container's isolated filesystem. This means a single compromised container can overwrite SUID binaries on the host and obtain a root shell on the host.
Kubernetes pods without explicit seccomp or AppArmor profiles are exposed by default. The syscalls required to run the exploit — socket(AF_ALG, ...), splice(), sendmsg() — are all permitted under the default Kubernetes RuntimeDefault seccomp profile. Unless your pods are running a strict custom seccomp profile or a dedicated LSM policy that explicitly blocks AF_ALG socket creation, your workloads are vulnerable on any unpatched node.
Cloud compute instances — AWS EC2, GCP Compute Engine, Azure VMs — running Linux are all affected by unpatched kernel versions in the same way as bare metal. CISA's KEV listing and Microsoft's threat intelligence report both confirm exploitation activity targeting cloud-hosted Linux workloads.
The combination of factors makes Copy Fail particularly dangerous in any multi-tenant environment: no network traffic to detect, no privileges required beyond a local shell, universal distribution coverage, and container-to-host escalation by default. An attacker who compromises a low-privilege container via a web application vulnerability has a reliable, silent path to host root.
Detection: Indicators of Exploitation
Detecting Copy Fail exploitation is non-trivial. The most damaging part of the attack — the page-cache write — produces no disk I/O, modifies no inode modification timestamp, and leaves no trace in standard system logs. File integrity monitoring tools (Tripwire, AIDE, osquery file events) that hash on-disk content will not detect this attack: the on-disk binary is unchanged throughout.
Auditd rule for AF_ALG socket creation. The most reliable detection primitive is auditing the socket() syscall with AF_ALG (family 38) as the first argument. Most production Linux systems have zero legitimate reason to open AF_ALG sockets from user processes. Add the following rule to /etc/audit/rules.d/copy-fail.rules:
-a always,exit -F arch=b64 -S socket -F a0=38 -k afalg_socket_create
This rule generates an audit event for every AF_ALG socket opened by any process. In most environments the legitimate baseline is zero; any event should trigger immediate investigation. Pair it with a SIEM alert rule on the afalg_socket_create key.
eBPF / Falco detection on splice() + SUID target. The combination of a splice() call on a file descriptor whose underlying inode has SUID mode bits set is a high-fidelity indicator of Copy Fail exploitation. Falco, Tetragon, or a custom Tracee policy can detect this in real time with low false-positive rate in most environments. A Falco rule that fires when a non-whitelisted process calls splice() on a setuid file is a practical starting point.
Anomalous execve of SUID binaries. If exploitation has succeeded, the attacker will execve a SUID binary (most likely /usr/bin/su) from an unexpected process tree — from a web server process, a container runtime, a cron job, or an SSH session running a restricted shell. Audit execve events on known SUID binaries and alert on those whose parent process chain does not match expected usage.
Unexpected root shells without PAM authentication events. A root shell obtained via Copy Fail will not have a corresponding PAM authentication success event (no password was entered). Correlating root shell creation (UID 0 process with no predecessor PAM event) in your SIEM is a useful secondary signal.
If you suspect exploitation has already occurred: reboot the system immediately. Because the attack modifies only the page cache, a reboot restores all file content from disk. However, if the attacker obtained root before you rebooted, assume persistence mechanisms have been installed — check crontabs, systemd units, SSH authorized_keys, and SUID binary checksums on disk against a known-good baseline.
filescanner.online
Scan Any File — Privately.
Deep binary analysis, YARA rules, AI summary, and PDF reports. Up to 2 GB. No account required.
Mitigation: Patch Now — Commands for Every Major Distribution
The definitive fix is kernel commit a664bf3d603d, which reverts algif_aead.c to out-of-place AEAD operation and removes the 2017 aliasing entirely. This commit is present in kernel 6.18.22, 6.19.12, and 7.0 and has been backported to all major distribution stable branches. Reboot into a patched kernel as soon as your change management process allows — CISA's May 15 deadline applies to federal agencies but is a reasonable target for everyone.
If you cannot immediately reboot into a patched kernel, the fastest interim mitigation is to unload or blacklist the algif_aead kernel module. This removes the vulnerable code path without a reboot. Most applications do not use AF_ALG AEAD directly; the impact is typically zero for production workloads.
| Action | Command | Notes |
|---|---|---|
| Ubuntu / Debian — patch kernel | sudo apt update && sudo apt full-upgrade && sudo reboot | Reboot required to load patched kernel |
| RHEL / AlmaLinux / Rocky — patch kernel | sudo dnf update kernel && sudo reboot | Reboot required |
| Amazon Linux 2023 — patch kernel | sudo dnf update kernel && sudo reboot | Reboot required |
| SUSE / openSUSE — patch kernel | sudo zypper update kernel-default && sudo reboot | Reboot required |
| Fedora — patch kernel | sudo dnf update kernel && sudo reboot | Reboot required |
| Unload module immediately (no reboot) | sudo rmmod algif_aead | Temporary — does not survive reboot |
| Blacklist module (persistent, pre-patch) | echo 'blacklist algif_aead' | sudo tee /etc/modprobe.d/disable-algif-aead.conf && sudo update-initramfs -u | Takes full effect after next reboot; run rmmod too for immediate coverage |
| Verify module is not loaded | lsmod | grep algif_aead | No output means the module is not loaded — vulnerable path is closed |
| Verify patched kernel version | uname -r | Compare against fixed version for your distro from your distro's security bulletin |
| Kubernetes — restrict AF_ALG at pod level | Apply seccomp profile blocking socket(AF_ALG,...) and splice() on all pod specs | Use OPA Gatekeeper or Kyverno to enforce at admission time |
Vulnerability Timeline
The following timeline documents key events from the introduction of the flaw in 2017 to the CISA mandatory remediation deadline.
| Date | Event |
|---|---|
| 2017 | Kernel commit 72548b093ee3 introduces in-place AEAD optimization in crypto/algif_aead.c — vulnerability silently introduced |
| 2017–2026 | Bug shipped in every major Linux distribution kernel update; no public discovery for nine years |
| April 1, 2026 | Upstream fix commit a664bf3d603d merged into Linux kernel mainline; Fixes: tag points to 72548b093ee3 |
| April 29, 2026 | CVE-2026-31431 publicly disclosed by Theori Xint Code team; 732-byte Python PoC released simultaneously |
| April 30, 2026 | Distribution patches begin rolling out: Ubuntu, RHEL, Debian, SUSE, Amazon Linux, AlmaLinux, Fedora |
| May 1, 2026 | Microsoft Security Blog publishes threat intelligence report documenting active exploitation in cloud Linux environments |
| Early May 2026 | CISA adds CVE-2026-31431 to Known Exploited Vulnerabilities (KEV) catalog — in-the-wild exploitation confirmed |
| Early May 2026 | Community C ports of the PoC published on GitHub (tgies/copy-fail-c, pyroceper/copy-fail-CVE-2026-31431) |
| May 6, 2026 | Kaspersky, Sysdig, SafeBreach, CERT-EU, and Help Net Security publish analysis reports |
| May 15, 2026 | CISA mandatory remediation deadline for all FCEB agencies |
The Lesson of Copy Fail: Nine Years of Silent Risk
Copy Fail is not unique in its story arc, but it is exceptional in its clarity. A well-intentioned performance optimization was applied to a complex crypto code path. The optimization introduced a semantic violation — aliasing source and destination in a routine that performs side-effecting writes before its authentication check — that had no immediate visible effect, passed all existing tests, and was invisible in isolation to anyone who was not specifically aware of the ESN rearrangement behavior of the authencesn composite template. It sat in the kernel for nine years.
What makes Copy Fail especially instructive is not the bug itself but the exploit's simplicity. A CVSS 7.8 score suggests a moderately complex attack. The reality is a 732-byte Python script that is more portable than most hello-world programs. The gap between the formal severity score and the practical weaponization effort is enormous — and it is a reminder that CVSS scores describe properties of the vulnerability, not the difficulty of exploitation in context.
For defenders, the most important takeaway is operational: patch and reboot as fast as your change management process allows. CISA's KEV inclusion confirms this is not a theoretical risk. The module blacklist (blacklist algif_aead) is a meaningful interim measure for systems that cannot reboot immediately — implement it today on every host that is not yet running a patched kernel.
For detection engineers: the AF_ALG socket creation auditd rule described in this article should be deployed to every production Linux host. In most environments, the expected legitimate event rate is zero. This rule will catch Copy Fail exploitation — and any future vulnerability in the AF_ALG family — with very high precision.
For security architects reviewing Linux hardening baselines: add the full AF_ALG socket family to your kernel module restriction policies. Unless your workloads explicitly require userspace access to kernel crypto primitives, there is no reason to expose this interface. Blocking it costs nothing and eliminates a class of attack surface.
Copy Fail will be patched and, eventually, archived. But the pattern it represents — performance optimizations that violate safety invariants in ways that are invisible without deep domain knowledge of the surrounding code — is not patched by any single kernel commit. It will produce future vulnerabilities. The correct defense is to invest now in the detection infrastructure and kernel hardening posture that will contain the next one when it arrives.

FileScanner.online
URLScanner.online