
π Estudo de caso completo do CVE-2026-31431 (CopyFail) β vulnerabilidade crΓtica de escalada de privilΓ©gio no kernel Linux. Inclui anΓ‘lise tΓ©cnica, scripts de verificaΓ§Γ£o, hardening e playbook de resposta a incidentes. Fins educacionais.
Complete Case Study β How it was discovered, how it works, how to test, how to replicate (in a safe environment) and how to fix the critical vulnerability that affects almost all Linux distributions since 2017.
This repository is for strictly educational purposes. The information presented here is intended for security professionals, researchers, and cybersecurity students. Never use any technique described here on systems without explicit authorization. Misuse of this information may constitute a crime under Law No. 12,737/2012 (Carolina Dieckmann Law) and the Brazilian Internet Civil Rights Framework (Law No. 12,965/2014).
| Field | Detail |
|---|---|
| CVE ID | CVE-2026-31431 |
| Alias | CopyFail |
| Type | Local Privilege Escalation (LPE) |
| CVSS Score | 8.8 (High) / potentially Critical in a chain |
| Component | Linux Kernel β data copy mechanism |
| Versions | Linux Kernel β€ 7.0 (distributions since 2017) |
| Discovered by | Theori (security company) |
| Disclosed on | March 2026 |
| Upstream patch | Available ~1 week after responsible disclosure |
| CISA Status | Listed as actively exploited β KEV Catalog |
| CISA Deadline | Federal agencies must patch by 05/15/2026 |
The CopyFail vulnerability was discovered by the security company Theori during analysis of Linux kernel code, specifically in the subsystem responsible for copying data between memory spaces.
March/2026 β Theori researchers identify anomalous behavior in the kernel
March/2026 β Responsible disclosure to the kernel security team
~1 week later β Upstream patch available on kernel.org
May/2026 β Proof-of-concept (PoC) code publicly released
05/01/2026 β Microsoft publishes technical analysis
05/04/2026 β CISA adds to KEV Catalog (Known Exploited Vulnerabilities)
05/15/2026 β Deadline for patching in US federal agencies
The Linux kernel has internal routines responsible for copying data between different memory regions (userspace β kernelspace). The flaw is named CopyFail because the affected component fails to copy certain data when it should. This corrupts sensitive data structures inside the kernel, opening an exploitation window for privilege escalation.
The Linux kernel manages memory in two distinct spaces:
βββββββββββββββββββββββββββββββββββββββ
β USERSPACE β
β Attacker Process (uid=1000) β
β β calls malicious syscall β
ββββββββββββββββββ¬βββββββββββββββββββββ
β syscall
βΌ
βββββββββββββββββββββββββββββββββββββββ
β KERNELSPACE β
β Data copy routine β
β β BUG: fails to copy metadata β
β β corrupts control structure β
β β attacker manipulates pointer β
β β executes code as root β
βββββββββββββββββββββββββββββββββββββββ
uid=0 (root), gaining full control of the system// VULNERABLE version (simplified, for educational purposes)
int kernel_copy_data(struct user_request *req) {
struct kernel_buffer kbuf;
// BUG: copies only part of the data, ignoring critical fields
// Security fields (security_context) are not copied!
memcpy(&kbuf.data, req->data, req->size);
// β kbuf.security_context remains uninitialized (memory garbage)
process_buffer(&kbuf); // uses corrupted data
return 0;
}
// FIXED version
int kernel_copy_data(struct user_request *req) {
struct kernel_buffer kbuf;
// FIX: copies the entire struct, including security fields
if (copy_from_user(&kbuf, req, sizeof(struct kernel_buffer)))
return -EFAULT;
process_buffer(&kbuf);
return 0;
}
| Distribution | Version | Status |
|---|---|---|
| Red Hat Enterprise Linux | 10.1 | β Vulnerable |
| Ubuntu LTS | 24.04 | β Vulnerable |
| Amazon Linux | 2023 | β Vulnerable |
| SUSE Linux | 16 | β Vulnerable |
| Debian | Recent stable | β Vulnerable |
| Fedora | Recent | β Vulnerable |
| Kubernetes (nodes) | All on kernel β€7.0 | β Vulnerable |
β οΈ Any Linux distribution running kernel β€ 7.0 released since 2017 is potentially vulnerable.
An unprivileged user on a shared server (e.g., hosting environment, VPS) runs the exploit and obtains root.
Internet β [RCE via web vulnerability] β limited shell β [CopyFail] β root
According to Microsoft's analysis: the flaw can be chained with an exploit delivered over the internet (e.g., RCE in a web application), resulting in full server compromise.
A Linux user is tricked into opening a malicious link or attachment that triggers the exploit locally.
A malicious actor compromises an open source developer account and injects the exploit into widely distributed code.
A compromised cloud server can expose all VMs, containers, applications, and customer databases on the same infrastructure.
β οΈ ONLY in a controlled and isolated environment β VM with no external network access!
# Required tools
sudo apt install -y git build-essential libssl-dev bc flex bison
# Check current kernel version
uname -r
# Check if it falls within the vulnerable range (β€ 7.0)
# Example of vulnerable output: 6.8.0-51-generic
# 1. Create an isolated VM (recommended: VirtualBox or QEMU)
# Use an Ubuntu 24.04 or Debian Bookworm ISO