Miggo Logo

GHSA-cq46-m9x9-j8w2: Scapy Session Loading Vulnerable to Arbitrary Code Execution via Untrusted Pickle Deserialization

N/A

CVSS Score

Basic Information

CVE ID
-
EPSS Score
-
Published
10/22/2025
Updated
10/22/2025
KEV Status
No
Technology
TechnologyPython

Technical Details

CVSS Vector
-
Package NameEcosystemVulnerable VersionsFirst Patched Version
scapypip<= 2.6.1

Vulnerability Intelligence
Miggo AIMiggo AI

Miggo AIRoot Cause Analysis

The vulnerability lies in the insecure deserialization of session files using Python's pickle module. The advisory points out that Scapy allows users to load session files via the -s command-line option, which triggers the deserialization of a user-controlled file.

The analysis of the provided patch commit 13621d1145b3435e9d03caf20997107a84435c0b confirms this. The patch entirely removes the session management feature, including the functions responsible for loading, saving, and updating sessions.

The key vulnerable functions identified are:

  1. load_session: This function was the primary entry point for loading a session from a file. It directly used pickle.load() on the file path provided, which is the root cause of the vulnerability.
  2. init_session: This function was called on startup to initialize the Scapy session. It contained logic to load an existing session from a file using pickle.load(), making it another vector for the same vulnerability.
  3. update_session: This function was used to update an existing session from a file, and it also used pickle.load(), making it vulnerable.

During exploitation, an attacker would craft a malicious .pkl.gz file containing a pickled object with a __reduce__ method that executes arbitrary commands. When a user loads this file in Scapy, the load_session or init_session function would be called, triggering the pickle.load() call and executing the malicious code. The profiler would show one of these functions in the stack trace at the time of exploitation. The mitigation was to completely remove this functionality, as seen in the commit, eliminating the vulnerable functions.

Vulnerable functions

load_session
scapy/main.py
The function `load_session` is vulnerable to arbitrary code execution because it uses `pickle.load()` to deserialize a user-provided session file. An attacker can craft a malicious pickle file that, when loaded, executes arbitrary code. The patch completely removes this function.
init_session
scapy/main.py
The `init_session` function was vulnerable as it loaded and deserialized a session file specified via the `session_name` argument, which could be controlled from the command line. It used `pickle.load()` without any safety checks, allowing for arbitrary code execution. The patch removes this session-loading logic from the function.
update_session
scapy/main.py
Similar to `load_session`, the `update_session` function was vulnerable because it deserialized a file using `pickle.load()` to update the current session. This could be exploited for arbitrary code execution if a malicious file was provided. The patch completely removes this function.

WAF Protection Rules

WAF Rule

### Summ*ry *n uns*** **s*ri*liz*tion vuln*r**ility in S**py <v*.*.* *llows *tt**k*rs to *x**ut* *r*itr*ry *o** **w**n * m*li*ious s*ssion *il* is lo**lly lo**** vi* t** `-s` option**. T*is r*quir*s *onvin*in* * us*r to m*nu*lly lo** * m*li*ious s*s

Reasoning

T** vuln*r**ility li*s in t** ins**ur* **s*ri*liz*tion o* s*ssion *il*s usin* Pyt*on's `pi*kl*` mo*ul*. T** **visory points out t**t S**py *llows us*rs to lo** s*ssion *il*s vi* t** `-s` *omm*n*-lin* option, w*i** tri***rs t** **s*ri*liz*tion o* * us