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-live-code-corruption — CVE-2026-31431 (Copy Fail) novel exploit: live code corruption via page cache. Overwrites libc exit() code through MAP_PRIVATE page sharing — affects ALL running processes. | Kitploit
Tools/GitHubGitHub/ikow/cve-2026-31431-live-code-corruption
Privilege EscalationExploit FrameworksVulnerability AnalysisExploitationBinary Exploitation
GitHubikow/cve-2026-31431-live-code-corruption

CVE-2026-31431-live-code-corruption

CVE-2026-31431 (Copy Fail) novel exploit: live code corruption via page cache. Overwrites libc exit() code through MAP_PRIVATE page sharing — affects ALL running processes.

Most Popular

View all →

Discover the most used tools by our community.

Explore all tools

Browse our collection of tools

View all tools →
Share
View Repository
164 months agoNot yet reviewed

CVE-2026-31431 — Live Code Corruption via Page Cache

A novel exploitation technique for CVE-2026-31431 ("Copy Fail") that corrupts executable code of running processes through the Linux kernel's page cache, achieving root privilege escalation.

What's Different

All published exploits for this CVE corrupt data files — modifying /etc/passwd to change root's UID, or patching setuid binaries on disk. This exploit does something fundamentally different: it corrupts live executable code in memory through the kernel's page cache mechanism.

Published exploitsThis exploit
TargetData files (/etc/passwd, /usr/bin/su)Executable code (libc .text section)
MechanismFile content parsed by programsCode pages directly executed by CPU
ScopeSingle fileALL processes mapping libc
Disk changeYes (file content modified)No (only page cache in memory)
DetectionFile integrity monitoringInvisible to filesystem checks

How It Works

The Page Cache Insight

When Linux maps a shared library with MAP_PRIVATE, it doesn't immediately copy the file pages. Instead, the process's page table entries point directly to the page cache physical pages. The copy only happens on write (copy-on-write). For code pages (.text), processes never write to them — so they remain shared with page cache forever.

root@kitploit:~
Process A (bash)     Process B (su)      Page Cache (libc)
  ┌──────┐            ┌──────┐            ┌──────────┐
  │ PTE  │───────────>│      │            │ exit():  │
  │      │            │ PTE  │───────────>│ endbr64  │
  └──────┘            └──────┘            │ push rax │
    MAP_PRIVATE         MAP_PRIVATE       │ ...      │
    (clean page)        (clean page)      └──────────┘
                                               ↑
                                    Copy Fail writes here!

CVE-2026-31431 gives us a controlled 4-byte write to any readable file's page cache. By corrupting libc's code pages, we modify the instructions that every process executes.

The Exploit

  1. Write shellcode (39 bytes) to the on_exit() function location in libc's page cache — 10 writes of 4 bytes each
  2. Patch exit() to jump to our shellcode — 1 write of 4 bytes
  3. Trigger: any program that calls exit() (virtually every program) executes our shellcode

The shellcode performs setuid(0) → setgid(0) → execve("/bin/sh"), giving a root shell.

CVE-2026-31431 Overview

  • Bug: Logic error in crypto/algif_aead.c — the 2017 in-place optimization (72548b093ee3) allows splice() to feed page cache pages into AEAD decrypt. The authencesn algorithm's ESN rearrangement writes 4 scratch bytes back to the source scatterlist, corrupting the spliced file's page cache.
  • Primitive: Deterministic 4-byte write to any readable file's page cache
  • Requirements: None — AF_ALG sockets available to unprivileged users
  • Fix: Copy to out-of-place buffer before crypto operation (kernel 6.12.85+, 6.15+)

Usage

root@kitploit:~
# Compile
gcc -o exploit exploit.c

# Run as unprivileged user
./exploit /lib/x86_64-linux-gnu/libc-2.31.so

# Trigger — run any program (it calls exit())
su -c id
# uid=0(root) gid=0(root) groups=0(root)

Tested On

  • Kernel: 6.12.79 (Ubuntu/Debian, before fix in 6.12.85)
  • glibc: 2.31-0ubuntu9.7
  • Result: Full root shell, verified by kernel log: process 'id' launched '/bin/sh'

Files

  • exploit.c — Full exploit with shellcode injection
  • copyfail_test.c — Primitive verification (tests 4-byte write)

Timeline

  • 2017: In-place optimization introduced (72548b093ee3)
  • 2026-04-29: CVE-2026-31431 disclosed
  • 2026-04-30: Fix released in kernel 6.12.85
  • 2026-05-06: This exploit developed (novel live code corruption technique)

References

  • NVD — CVE-2026-31431
  • Fix commit
  • Copy Fail analysis (Xint)

Disclaimer

This tool is provided for authorized security research and educational purposes only. Do not use against systems you do not own or have explicit permission to test.

Related: Dirty Frag (May 7, 2026)

Dirty Frag disclosed two more page-cache write variants in the same bug class:

  • ESP path (esp4/esp6): Same authencesn sink as Copy Fail, reached via IPsec ESP-in-UDP. Requires user namespaces. 4-byte write.
  • RxRPC path (rxrpc/rxkad): pcbc(fcrypt) in-place decrypt on splice-pinned page. No namespaces needed. 8-byte write.

The live code corruption technique in this repo works with any of these page-cache write primitives — just replace the write4() function with the ESP or RxRPC trigger. The technique is primitive-agnostic.

Download Tool