CVE-2025-39682: Linux Kernel kTLS Receive Path Zero-Length Record Use-After-Free Privilege Escalation
HERMES THREAT SCORE & KERNEL PRIVILEGE ESCALATION
Target:Linux Kernel Core Subsystem β net/tls/ (Kernel TLS Software Receive Path) CVSS v3.1 rates CVE-2025-39682 at 7.8 High (CVSS:3.1/AV:L/AC:L/PR:L/UI:N/S:U/C:H/I:H/A:H) due to the local access vector requirement (AV:L). However, Hermes Threat Score evaluates it at 94 (CRITICAL / KEV Tier-1) following confirmed active in-the-wild exploitation cataloged by CISA on September 18, 2026. In cloud environments, shared Kubernetes worker nodes, and enterprise web servers, kTLS is widely enabled for hardware and software crypto offload. Attackers chaining web application compromise or container escapes leverage this flaw for deterministic, local root escalation across enterprise Linux distributions.
CVE-2025-39682: Linux Kernel kTLS Receive Path Zero-Length Record Use-After-Free Privilege EscalationVULNERABILITY
Software platform affected by security vulnerabilities and agentic attack patterns.
π Why is this related? (Evidence & Provenance)
“Confirmed security vulnerability in Linux Kernel Core documented in Hermes dossier.”
- [vulnerability_report]
- [government_confirmation]CISA verified active exploitation in the wild and mandated federal remediation deadline in KEV entry. — Source: Cybersecurity & Infrastructure Security Agency (CISA): CISA Adds CVE-2026-59822 to Known Exploited Vulnerabilities Catalog (Reliability: VERY_HIGH)
1. Technical Context & Attack Surface
Section titled β1. Technical Context & Attack SurfaceβkTLS is initialized on standard TCP sockets using the TCP_ULP (Upper Layer Protocol) socket option:
int sock = socket(AF_INET, SOCK_STREAM, 0);connect(sock, (struct sockaddr *)&target, sizeof(target));// Enable kernel TLS Upper Layer Protocolsetsockopt(sock, SOL_TCP, TCP_ULP, "tls", sizeof("tls"));// Configure symmetric crypto parameters for RXsetsockopt(sock, SOL_TLS, TLS_RX, &crypto_info, sizeof(crypto_info));Once enabled, all incoming ciphertext is decrypted by the kernelβs asynchronous or synchronous crypto drivers, assembling plaintext into socket buffers placed on tls_sw_context_rx->rx_list.
| Parameter | Technical Detail | Operational Impact |
|---|---|---|
| CVE Identifier | CVE-2025-39682 | CISA KEV Catalog Entry 2026-09-18 |
| Vulnerability Class | Use-After-Free (CWE-416) & Unusual Condition Handling (CWE-754) | Local Privilege Escalation (LPE) to root |
| Vulnerable Component | net/tls/tls_sw.c (tls_sw_recvmsg) | Kernel in-tree TLS networking subsystem |
| Trigger Vectors | Local unprivileged invocation of recvmsg() on crafted kTLS TCP socket | Local shell, container, or web application RCE |
| Authentication Required | Low (PR:L) / Local unprivileged shell or container UID | Local execution without root or special capabilities |
| Impact | Complete Kernel Ring-0 Execution / Credential Harvesting | Full operating system root takeover |
| Affected Versions | 6.0β6.1.148, 6.2β6.6.102, 6.7β6.12.43, 6.13β6.16.3, 6.17-rc1..rc2 | Linux distributions enabling CONFIG_TLS |
| Remediated Release | Maintenance kernels 6.1.149, 6.6.103, 6.12.44, 6.16.4, 6.17 | Distribution vendor backports (RHEL, Ubuntu, Debian) |
2. Root Cause Analysis & Vulnerable Mechanics
Section titled β2. Root Cause Analysis & Vulnerable MechanicsβThe core vulnerability resides in the loop inside tls_sw_recvmsg() that iterates through the socketβs receive queue (ctx->rx_list) to service a userβs recvmsg() buffer.
The Semantic Constraint of recvmsg()
Section titled βThe Semantic Constraint of recvmsg()βBy specification, a single recvmsg() invocation on a kTLS socket must deliver either:
- One or more contiguous DATA records (application payload).
- Exactly one non-DATA control record (e.g., TLS alerts, handshake renegotiation records, or heartbeat messages).
Under no circumstance should control records and data records be co-mingled or processed out of order in a single receive pass.
The Zero-Length Record Flaw in tls_sw_recvmsg()
Section titled βThe Zero-Length Record Flaw in tls_sw_recvmsg()βWhen a peer sends a TLS record containing zero plaintext bytes (e.g., an empty application data frame or zero-length alert), the decryption routines process the record and push the corresponding sk_buff to rx_list:
/* Simplified representation of vulnerable logic in net/tls/tls_sw.c */static int tls_sw_recvmsg(struct sock *sk, struct msghdr *msg, size_t len, int flags, int *addr_len){ struct tls_context *tls_ctx = tls_get_ctx(sk); struct tls_sw_context_rx *ctx = tls_sw_ctx_rx(tls_ctx); struct sk_buff *skb; ... while (len && (skb = tls_wait_data(sk, flags, timeo, &err))) { /* * FLAW: When skb->len is 0, the record validation does not properly * break or consume the control record type. Instead, the loop treats * the record as empty, unlinks it, but fails to reset the record-type * state tracker. */ if (skb->len == 0) { tls_rx_rec_done(ctx); kfree_skb(skb); continue; /* Loop continues with stale record-type assumptions */ } ... err = process_rx_list(ctx, skb, &len); } return copied;}Because the zero-length record check frees the skb via kfree_skb() without updating the parser state machine, a subsequent loop iteration encounters mismatched pointers in ctx->rx_list. When the next message arrives, the kernel references memory that was already returned to the kmalloc-512 or skbuff_head_cache slab allocator.
βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ kTLS USE-AFTER-FREE TIMELINE βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ€β T0: Peer queues Zero-Length Record followed by Malicious Control Frame ββ T1: tls_sw_recvmsg() dequeues zero-length skb and frees via kfree_skb ββ T2: Internal state flags fail to reset; rx_list tail pointer lingers ββ T3: Attacker grooms kmalloc slab with controlled pseudo-skb payload ββ T4: tls_sw_recvmsg() re-dereferences lingering pointer -> KERNEL UAF ββ T5: Hijacks sk->sk_data_ready / function pointer -> Ring 0 Root Shell βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ3. Exploit Execution Flow
Section titled β3. Exploit Execution FlowβIn the wild, threat actors have operationalized this flaw into a reliable local root exploit targeting cloud VMs and Kubernetes pods:
- Local Foothold: The attacker acquires local unprivileged shell access (via an SSH credential, container escape, or a web application RCE in Python/PHP).
- Socket Initialization: The exploit opens a local loopback TCP connection, sets
TCP_ULPto"tls", and programs symmetric session keys viasetsockopt(..., SOL_TLS, TLS_RX). - Payload Injection: Over the socket, the exploit transmits an encrypted sequence: a zero-length TLS application data frame immediately followed by an out-of-order control record.
- Triggering the Free: The exploit calls
recvmsg()with flags set to read only a fraction of the buffer, forcingtls_sw_recvmsginto the zero-length processing branch where thesk_buffis freed while remaining referenced. - Slab Spraying & Reallocation: The attacker rapidly sprays the
kmalloc-1024orskbuff_head_cacheslab cache usingsendmsg()with crafted ancillary data (SCM_RIGHTS) to occupy the vacated memory chunk with controlled data. - Privilege Escalation: When the kernel performs a subsequent cleanup or poll operation, it calls a function pointer from the attacker-controlled slab object. The payload executes in Ring 0, modifies the current process credentials (
commit_creds(prepare_kernel_cred(NULL))), and escapes to a root shell.
4. Forensic Investigation & Telemetry
Section titled β4. Forensic Investigation & TelemetryβKernel Panic & OOPS Signatures
Section titled βKernel Panic & OOPS SignaturesβExploitation attempts, both successful and failed, leave distinct traces in the kernel ring buffer (dmesg / /var/log/messages):
- General Protection Faults: Look for crashes originating in
net/tls/routines:BUG: unable to handle page fault for address: ffff888012345678#PF: supervisor read access in kernel mode#PF: error_code(0x0000) - not-present pageWorkqueue: events tls_sk_proto_closeRIP: 0010:tls_sw_recvmsg+0x3ba/0x780 [tls]Call Trace:<TASK>inet_recvmsg+0x54/0x130sock_recvmsg+0x3f/0x70__sys_recvmsg+0x8a/0x100do_syscall_64+0x58/0x80 - KASAN Reports: Systems running kernels with Kernel Address Sanitizer (KASAN) enabled log explicit
use-after-freealerts identifyingkfree_skbas the release locus.
Host Telemetry & Artifacts
Section titled βHost Telemetry & Artifactsβ- Suspicious Socket Allocation: Look for unprivileged processes (e.g.,
www-data,nobody, low-privilege service accounts) invokingsetsockoptwith levelSOL_TCP(6) and optionTCP_ULP(31) specifying the string"tls". - Credential Escalation Events: Audit for sudden process UID/GID transitions (
auditdSYSCALL event forsetuidor child processes spawned by low-privilege daemons withuid=0).
5. Detection Engineering
Section titled β5. Detection Engineeringβtitle: Linux Kernel kTLS Subsystem Crash or Panicid: d82e1456-913a-4e2b-8711-2b8c9e253968status: experimentaldescription: Detects kernel oops, GPFs, or KASAN use-after-free warnings originating in the kTLS subsystem, indicative of CVE-2025-39682 exploitation.logsource: product: linux service: kerneldetection: selection: - 'tls_sw_recvmsg' - 'BUG: unable to handle page fault' - 'kernel NULL pointer dereference' - 'KASAN: use-after-free in tls_sw_recvmsg' condition: selectionlevel: criticaltags: - attack.privilege_escalation - attack.t1068 - cve.2025-39682# Monitor unprivileged setsockopt calls configuring TCP_ULP or TLS-a always,exit -F arch=b64 -S setsockopt -F a1=6 -F a2=31 -k ktls_ulp_register-a always,exit -F arch=b64 -S setsockopt -F a1=282 -k ktls_crypto_config// Azure Sentinel / Syslog Hunting QuerySyslog| where Facility == "kern" or ProcessName == "kernel"| where SyslogMessage has_any ("tls_sw_recvmsg", "net/tls", "tls_sw_ctx_rx")| where SyslogMessage has_any ("BUG: unable", "page fault", "use-after-free", "general protection fault")| project TimeGenerated, HostName, Facility, SyslogMessage| sort by TimeGenerated desc6. Remediation & Hardening Strategy
Section titled β6. Remediation & Hardening StrategyβImmediate Remediation
Section titled βImmediate Remediationβ- Kernel Update: Upgrade to the latest distribution kernel maintenance release immediately:
- RHEL 9 / Rocky / AlmaLinux: Apply RHSA-2026-ktls errata.
- Ubuntu 24.04 / 22.04 LTS: Update to kernel
6.8.0-45-generic/5.15.0-118-generic. - Debian 12 Bookworm: Apply
linux-image-6.1.0-25-amd64or later.
- CISA KEV Compliance: For US federal agencies and organizations governed by BOD 22-01, remediation must be completed and documented by October 9, 2026.
Temporary Workaround (Module Blacklisting)
Section titled βTemporary Workaround (Module Blacklisting)βIf an immediate kernel reboot cannot be scheduled, prevent unprivileged users from loading or binding to the kTLS subsystem by blacklisting the kernel module:
# Blacklist the kTLS kernel moduleecho "install tls /bin/true" | sudo tee /etc/modprobe.d/disable-tls.confecho "blacklist tls" | sudo tee -a /etc/modprobe.d/disable-tls.conf
# If currently loaded and not actively required by critical web servers:sudo modprobe -r tlsNote: Disabling kTLS falls back to standard user-space TLS processing (e.g., OpenSSL / BoringSSL), causing a minor CPU overhead increase without disrupting application connectivity.
7. Strategic Cross-References
Section titled β7. Strategic Cross-Referencesβ8. Sources & References
Section titled β8. Sources & Referencesβ- CISA KEV Catalog: CISA Known Exploited Vulnerabilities Catalog (Added 2026-09-18)
- Linux Kernel Source Git: tls: fix handling of zero-length records on the rx_list
- Star Labs SG Research: Exploring kTLS Receive Path State Machine Vulnerabilities (August 2025)
- NIST National Vulnerability Database: CVE-2025-39682 Detail