← back
CVE-2025-39946

tls: make sure to abort the stream if headers are bogus

CVSS 9.8 CRITICALEPSS 9.1%
In short

A flaw in Linux kernel's TLS implementation allows an attacker to cause a buffer overflow by sending malformed TLS record headers in small fragments followed by large data, potentially crashing the system or executing code.

Technical detail

The vulnerability exists in TLS record parsing when the kernel buffers incomplete records and attempts to recover by re-parsing with additional socket data. An attacker can exploit this by sending fragmented bogus headers followed by a large payload, causing the parser to overflow the allocated skb space when it retries parsing. The issue occurs because tls_rx_msg_size() fails to abort the stream parser (strp) upon detecting invalid records, allowing continued processing of corrupt data.

Summary generated and translated by AI from the official description.
In the Linux kernel, the following vulnerability has been resolved: tls: make sure to abort the stream if headers are bogus Normally we wait for the socket to buffer up the whole record before we service it. If the socket has a tiny buffer, however, we read out the data sooner, to prevent connection stalls. Make sure that we abort the connection when we find out late that the record is actually invalid. Retrying the parsing is fine in itself but since we copy some more data each time before we parse we can overflow the allocated skb space. Constructing a scenario in which we're under pressure without enough data in the socket to parse the length upfront is quite hard. syzbot figured out a way to do this by serving us the header in small OOB sends, and then filling in the recvbuf with a large normal send. Make sure that tls_rx_msg_size() aborts strp, if we reach an invalid record there's really no way to recover.
CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:H/A:H
Affected products
Linux · Linux

Want to know if your infrastructure is exposed to this?

Talk to TrueHacking →