Skip to content
KitploitKITPLOIT
ToolsExploitsBlog
Log in
Submit
ToolsExploitsBlog
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.

FeedsContactPrivacy© 2026 Kitploit

Tool Directory

Categories

View all categories
Loading categories
Tools/GitHubGitHub/astounds/copy-fail-cve-2026-31431
Privilege EscalationExploit FrameworksVulnerability AnalysisExploitationLearning & EducationBinary ExploitationLabs & Practice
GitHubastounds/copy-fail-cve-2026-31431

Most Popular

View all →

Discover the most used tools by our community.

Explore all tools

Browse our collection of tools

View all tools →
Share

copy-fail-CVE-2026-31431

Local privilege escalation exploit for CVE-2026-31431, a Linux kernel AF_ALG + splice page-cache overwrite. Includes PoC, BPFtrace detection script, and QEMU test environment for authorized security research.

View Repository
155 months agoNot yet reviewed

CVE-2026-31431 — Copy Fail

Linux kernel local privilege escalation via AF_ALG + splice page-cache overwrite

CVE CVSS License

For authorized security research, penetration testing, and educational purposes only. Do not use against systems you do not own or have explicit written permission to test.

Technical Writeup


Table of Contents

  • Description
  • Vulnerability Details
  • Repository Structure
  • Quick Start
  • Detection
  • Requirements
  • Mitigation
  • Test Environment (optional)
  • References
  • License

Description

CVE-2026-31431 is a local privilege escalation (LPE) vulnerability in the Linux kernel. An unprivileged local user can gain root access by combining the AF_ALG socket interface with splice() to perform an authenticated write directly into a page-cache page belonging to a setuid binary.

The exploit overwrites the su binary in the page cache without modifying the on-disk inode, bypassing integrity mechanisms that rely solely on file metadata or block-level checksums.


Vulnerability Details

FieldValue
CVE IDCVE-2026-31431
TypeLocal Privilege Escalation (LPE)
CVSS v3.1 Score7.8 High — AV:L/AC:L/PR:L/UI:N/S:U/C:H/I:H/A:H (source: kernel.org)
Kernel subsystemscrypto/af_alg.c, mm/splice.c
Attack vectorLocal — unprivileged user account required
Root causealgif_aead accepts sendfile() over an AEAD socket without enforcing copy-on-write semantics on the mapped page-cache page prior to splice() completing the transfer

Affected Environments

DistroKernel versionArch
Ubuntu 24.04 LTS6.17.0-1007-awsx86_64
Amazon Linux 20236.18.8-9.213.amzn2023x86_64
RHEL 10.16.12.0-124.45.1.el10_1x86_64
SUSE 166.12.0-160000.9-defaultx86_64
Raspberry Pi OS (Pi 5)6.12.75+rpt-rpi-2712aarch64

Repository Structure

.
├── exploit.py    # PoC — page-cache overwrite and privilege escalation
├── detect.bt     # BPFtrace script for real-time detection
├── run-vm.sh     # QEMU test environment automation (optional)
├── PAYLOAD.md    # Payload encoding analysis (hex → zlib → ELF → shellcode)
└── LICENSE

Quick Start

Run exploit.py as an unprivileged local user on any vulnerable system — no sudo needed:

python3 exploit.py

The script performs the following steps:

  1. Verifies kernel support for AF_ALG (algif_aead) and locates the su binary.
  2. Selects and decompresses the architecture-appropriate payload.
  3. Opens the su binary as a raw file descriptor and overwrites its page-cache pages via AF_ALG + sendfile.
  4. Tests privilege escalation. If successful, drops into a root shell.

Supported architectures:

ArchitectureVariants
x86_64—
aarch64—
riscv64—
ppc64le—
armarmv5l, armv6l, armv7l
x86 32-biti386, i486, i586, i686
MIPS 64-bitmips64, mips64el
LoongArchloong64, loongarch64
s390x—

Detection

Monitor for exploitation attempts in real time with detect.bt. Requires root:

sudo bpftrace detect.bt
# or
doas bpftrace detect.bt

The script tracks three indicators per PID using a bitmask in @suspect[pid]:

BitSyscallIndicator
0x1socket(AF_ALG, SOCK_SEQPACKET)AF_ALG socket created
0x2setsockopt(SOL_ALG, ...)Crypto operation configured
0x4sendmsg(MSG_MORE) + splice()Page-cache overwrite attempted

An alert fires when all three bits are set (@suspect[pid] == 0x7) on the same PID.


Requirements

exploit.py

  • Python 3.6+
  • Linux kernel with AF_ALG/algif_aead module loaded
  • Local unprivileged user account (root is not required)

detect.bt

  • bpftrace ≥ 0.12
  • Root privileges (required for BPF tracing)
# Ubuntu/Debian
sudo apt install bpftrace

# RHEL/CentOS/Fedora
sudo dnf install bpftrace

# Amazon Linux
sudo yum install bpftrace

# SUSE
sudo zypper install bpftrace

# Alpine
sudo apk add bpftrace

Mitigation

1. Patch (preferred)

Update your distribution's kernel package to one that includes mainline commit a664bf3d603d, which reverts the 2017 algif_aead in-place optimization so that page-cache pages can no longer end up in the writable destination scatterlist. Most major distributions are shipping the fix now.

2. Disable algif_aead (while waiting for a patch)

blacklist can be bypassed with an explicit modprobe algif_aead. The install .../bin/false directive overrides the install command entirely, making every load attempt fail:

echo "install algif_aead /bin/false" | sudo tee /etc/modprobe.d/disable-algif.conf
sudo rmmod algif_aead 2>/dev/null || true

What this breaks — almost nothing

Affected?Subsystem/Use case
Nodm-crypt/LUKS, kTLS, IPsec/XFRM, in-kernel TLS
NoOpenSSL, GnuTLS, NSS default builds
NoSSH, kernel keyring crypto
MaybeOpenSSL with the afalg engine explicitly enabled
MaybeEmbedded crypto offload paths or apps that bind aead/skcipher/hash sockets directly
Download Tool