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 — 对 CVE-2026-31431 的复现分析、C 改编的 exp。 | Kitploit
Tools/GitHubGitHub/hulnothutu/cve-2026-31431
Privilege EscalationExploit FrameworksVulnerability AnalysisExploitationShellcodeLearning & EducationPayload DevelopmentContainer EscapeBinary Exploitation
GitHubhulnothutu/cve-2026-31431

CVE-2026-31431

对 CVE-2026-31431 的复现分析、C 改编的 exp。

3 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
View Repository

CVE-2026-31431

Structure

root@kitploit:~
.
├── container
│   ├── container.md  # Container escape ideas
│   ├── expenv  # Container environment
│   │   ├── bin
│   │   │   ├── gscontainer
│   │   │   └── share
│   │   ├── Dockerfile
│   │   ├── run.sh
│   │   └── src
│   │       ├── gscontainer.c
│   │       └── share.c
│   ├── images
│   │   ├── container.png
│   │   ├── getshell.png
│   │   ├── host.png
│   │   ├── payload.png
│   │   └── share.png
│   ├── recode.bin  # Single-stage shellcode
│   └── stager
│       ├── shell.elf  # Staged shellcode embedded in the exploit
│       ├── stager1.bin
│       ├── stager2.bin
│       ├── stager3.bin
│       └── stager4.bin
├── doc
│   ├── cve-2026-31431.md  # xint.io analysis summary
│   └── shellcode.md  # Introduction to what shellcode is
├── exp.py # curl http://copy.fail/exp -o exp.py
├── README.md
├── success
│   ├── code.py  # Shellcode extracted from exp.py
│   └── exploit.c # C-based minimal exploit with native msf privilege escalation shellcode, needs its own bypass
└── test
    ├── exptest.c # Without comments
    └── test.c # Correct and with comments for easier understanding

Accidental Intersection of Three Commit Chains

Three individually harmless commits combined to create the vulnerability:

Exploit Flow

root@kitploit:~
splice(file → pipe → AF_ALG)
    ↓
af_alg_sendmsg: file page cache pages → TX SGL (zero-copy)
    ↓
_aead_recvmsg: in-place optimization
   ├─ memcpy_sglist: copy AAD+ciphertext to RX SGL
   ├─ sg_chain: chain tag page (still pointing to file page cache) into RX SGL
   └─ req->src = req->dst (= scatterlist containing file page cache pages)
    ↓
crypto_authenc_esn_decrypt: ESN reordering
   └─ scatterwalk_map_and_copy(tmp+1, dst, assoclen+cryptlen, 4, 1)
      ↓ traverse dst scatterlist to tag position
      ↓ kmap_local_page() maps file page cache page
      ↓ memcpy: writes seqno_lo into file page cache page
    ↓
HMAC verification fails → returns -EBADMSG
    ↓
File page cache page modified, kernel does not mark page dirty, disk file unchanged

CVE-2026-31431 Affected Versions

The paper claims "almost all Linux distributions" since 2017 are affected. Page cache is shared across containers, making this vulnerability both a local privilege escalation (LPE) and a container escape vector.

CVE-2026-31431 Fix

The upstream fix commit a664bf3d603d reverts AF_ALG AEAD operations to out-of-place (separate src and dst):

root@kitploit:~
Before: aead_request_set_crypt(..., rsgl_src,
                                areq->first_rsgl.sgl.sgt.sgl, ...)
                                ^  src == dst  ^

After:  aead_request_set_crypt(..., tsgl_src,
                                areq->first_rsgl.sgl.sgt.sgl, ...)
                                ^  src ≠ dst  ^  (TX SGL for src, RX SGL for dst)

Commit message: "There is no benefit in operating in-place in algif_aead since the source and destination come from different mappings."

Emergency mitigation:

root@kitploit:~
echo "install algif_aead /bin/false" > /etc/modprobe.d/disable-algif-aead.conf
rmmod algif_aead

Or block AF_ALG socket creation (socket(AF_ALG, ...)) via seccomp policy.


Summary


References

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

https://github.com/0xShe/CVE-2026-31431

Download Tool
TimeCommitImpact
2011a5079d084f8bauthencesn added, uses dst scatterlist as temporary space for ESN reordering. Harmless at this point — the old AEAD interface kept AAD separate, and the only caller was the kernel xfrm.
2015104880a6b470authencesn converted to the new AEAD interface, introducing the behavior of writing seqno_lo "past the output boundary" at assoclen+cryptlen. Still not exploitable — because AF_ALG uses out-of-place mode, req->src and req->dst are separate, and page cache pages are only in read-only src.
201772548b093ee3AF_ALG in-place optimization. Copies AAD+ciphertext from TX SGL to RX buffer, but chains the tag page via sg_chain. Sets req->src = req->dst. Now page cache pages introduced by splice are also in the writable dst scatterlist. Vulnerability formed.
DistributionKernel VersionAffected
Ubuntu 24.04 LTS6.17.0-1007-awsYes
Amazon Linux 20236.18.8-9.213.amzn2023Yes
RHEL 10.16.12.0-124.45.1.el10_1Yes
SUSE 166.12.0-160000.9-defaultYes
FeatureSource VerificationDescription
authencesn writes seqno_lo to the endauthencesn.c:134Writes seqno_lo (low 32 bits) at assoclen+cryptlen. User description is correct.
ESN reordering conventionBlog confirms (xint.io)AAD bytes 0-3 = seqno_hi, bytes 4-7 = seqno_lo. tmp[1] (=bytes 4-7=seqno_lo) is written to the end.
Decryption path does not restore overwritten bytesauthencesn.c:270-273 vs 215-217decrypt_tail restores ESN at offset 0-7 but never restores original bytes at assoclen+cryptlen. Encryption path (genicv_tail) restores before writing ICV.
AF_ALG in-place encryption/decryptionalgif_aead.c:189-252rsgl_src points to the same RX SGL as areq->first_rsgl.sgl.sgt.sgl.
AF_ALG tag chainingalgif_aead.c:238-244During decryption, tag is referenced via sg_chain instead of copied — in splice scenarios, the tag page still points to file page cache. Root cause of security vulnerability.
Splice zero-copy transferfs/splice.c:876, af_alg.c:1049, lib/scatterlist.c:1167Directly references pipe pages, zero-copy.
CVE-2026-31431Three commit chainsauthencesn(2011/2015) + in-place(2017) + splice zero-copy = controllable page cache write primitive.