Uncontrolled Recursion in scapy - #VU159475

 

Uncontrolled Recursion in scapy - #VU159475

Published: November 5, 2026


Vulnerability identifier: #VU159475
CSH Severity: Low
CVSS v4: 4.6 [CVSS:4.0/AV:L/AC:L/AT:N/PR:N/UI:A/VC:N/VI:N/VA:L/SC:N/SI:N/SA:N]
CVE-ID: N/A
CWE-ID: CWE-674
Exploitation vector: Remote access
Exploit availability: No public exploit available

Vulnerability details

The vulnerability allows a remote server to terminate a Scapy stream transaction by exhausting Python's recursion limit with a finely fragmented, otherwise valid application response. This causes a denial of service for the transaction: Python raises RecursionError before the complete application message is decoded, even when the message is small.

The vulnerability exists due to uncontrolled recursion in StreamSocketPeekless.recv, which calls itself whenever session processing needs more bytes instead of returning a complete packet. Each receive retains a Python stack frame, so recursion depth grows with the number of fragments rather than the message size. A remote attacker can operate a server that a user chooses to connect to and split its response across enough small TLS records or TCP writes to trigger the recursion limit when the client uses this socket wrapper with a length-sensitive parser.

StreamSocketPeekless reassembles protocols on streams where MSG_PEEK cannot be used; SSLStreamSocket is an older name for the same class, and LDAP_Client(ssl=True) uses it with the LDAP parser. The demonstrated 1,106-byte LDAP response raised RecursionError after 996 one-byte reads, while the same response delivered in one read decoded successfully. The exception originates in the socket wrapper, outside payload decoding, so fallback to Raw does not absorb it. Because the wrapper directly invokes session processing and recurses while the outer session is still waiting for sock.recv() to return, the failure also occurs outside the outer session's exception containment.


Affected software

scapy

Remediation

Install security update from vendor's website.

scapy - update to 2.8.0

External References

Related Security Bulletins