Improper Check or Handling of Exceptional Conditions in scapy - #VU159464
Published: November 5, 2026
Vulnerability details
The vulnerability allows loss of availability of Scapy offline capture processing: malformed capture data can silently hide subsequent packets or abort reading without returning packets already decoded. A valid gzip capture supplied through a named non-seekable stream can also fail before any packet is extracted. The demonstrated impact is limited to capture-processing availability, without confidentiality loss, modification, code execution, or persistence after a retry.
The vulnerability exists due to five distinct record-framing and exception-handling defects in scapy/utils.py. A remote attacker can supply capture data that triggers these failures when a user or application opens it with the corresponding offline reader; the non-seekable-stream case additionally requires delivery through a named pipe or equivalent input. In PCAPNG, an Enhanced Packet Block referencing an undeclared interface causes _check_interface_id() to raise EOFError, which terminates the entire iterator rather than skipping the block and silently hides valid later packets. In ERF, a Type ETH record with rlen=0 produces a negative payload-read length; Python consumes the following record, returning a bogus packet and losing the legitimate later packet without an initial exception. For gzip-compressed PCAP, a corrupted trailing CRC raises BadGzipFile during the next-header read outside the exception handler, preventing return of the list even after packets have been decoded. A PCAPNG block declaring a body longer than the remaining input raises an uncaught Scapy_Exception, likewise discarding the accumulated list. Finally, gzip detection consumes the magic bytes and calls seek(0) on a named non-seekable stream, raising io.UnsupportedOperation even when the compressed capture is valid.
Scapy's rdpcap() reads classic PCAP and PCAPNG into an internally accumulated packet list, while rderf() handles ERF. Their iterators interpret EOFError as whole-file completion, and rdpcap() returns its list only after iteration completes. Consequently, premature completion can appear to the caller as a complete result with no indication of unread records, while escaping exceptions prevent return of the partial list. These failures occur during source opening or record framing, before packet-payload dissection, so the packet-level Raw fallback does not contain them. No special privileges, live capture, contributed module, configuration change, or non-default conf.debug_dissector setting is required.