CVE-2025-10157 Overview
A Protection Mechanism Failure vulnerability exists in mmaitre314 picklescan versions up to and including 0.0.30 that allows a remote attacker to bypass the unsafe globals check. This security flaw stems from the scanner performing an exact match for module names, which enables malicious payloads to be loaded via submodules of dangerous packages (e.g., asyncio.unix_events instead of asyncio).
When a file incorrectly considered safe by the scanner is subsequently loaded, it can lead to the execution of arbitrary malicious code. This represents a significant security risk for any application relying on picklescan to validate Python pickle files before loading them.
Critical Impact
Remote attackers can bypass picklescan's security controls and execute arbitrary code by crafting malicious pickle files that use submodule paths to evade detection.
Affected Products
- mmaitre314 picklescan versions ≤ 0.0.30
Discovery Timeline
- September 17, 2025 - CVE-2025-10157 published to NVD
- November 13, 2025 - Last updated in NVD database
Technical Details for CVE-2025-10157
Vulnerability Analysis
This vulnerability is classified as CWE-693 (Protection Mechanism Failure), which occurs when a security mechanism fails to provide adequate protection against threats it was designed to mitigate. In this case, picklescan is designed to identify and block dangerous Python pickle files that could execute malicious code when deserialized.
The fundamental issue lies in how picklescan validates module names during its security scanning process. The scanner uses exact string matching to compare module names against a blocklist of known dangerous modules. However, Python's import system allows code execution through submodules that share a common parent with blocked modules but have different fully-qualified names.
For example, if asyncio is blocked as a dangerous module, an attacker can bypass this protection by importing asyncio.unix_events or other submodules instead. The scanner treats these as distinct, unrelated modules because the exact string comparison fails to match.
Root Cause
The root cause is an incomplete implementation of module name matching in the picklescan security scanner. The exact match approach used in the scanner.py module does not account for Python's hierarchical module namespace, where blocking a parent module should logically also block all its child submodules to maintain security guarantees.
The vulnerable code path performs string comparison without considering module hierarchy, treating asyncio and asyncio.unix_events as completely separate entries rather than recognizing their parent-child relationship.
Attack Vector
The attack is network-accessible and requires no authentication or user interaction. An attacker can exploit this vulnerability by:
- Crafting a malicious pickle file that references submodules of blocked dangerous packages
- Distributing the malicious pickle file through any vector that relies on picklescan for validation (e.g., model repositories, file uploads)
- When the file passes picklescan's safety check and is subsequently loaded by the application, the malicious payload executes
A proof-of-concept malicious pickle file has been published on Hugging Face demonstrating exploitation using the asyncio.unix_events submodule to bypass detection.
The attack leverages Python's pickle deserialization, which by design can instantiate arbitrary objects and execute code. Picklescan was created specifically to mitigate this risk, making this bypass particularly severe.
Detection Methods for CVE-2025-10157
Indicators of Compromise
- Pickle files containing references to submodules of known dangerous packages (e.g., asyncio.unix_events, subprocess.Popen)
- Unexpected process execution or network connections following pickle file loading
- Log entries showing pickle files passing security scans while containing suspicious module references
- Presence of pickle files with unusual or deeply nested module import paths
Detection Strategies
- Implement static analysis of pickle files to detect submodule references that share parent modules with blocked packages
- Monitor pickle deserialization events for module loading patterns that include submodules of restricted namespaces
- Deploy file integrity monitoring for applications that process untrusted pickle files
- Review picklescan scan results for files with unusual import patterns
Monitoring Recommendations
- Enable verbose logging in picklescan to capture detailed module reference information
- Implement alerting for any pickle file processing in sensitive environments
- Monitor system calls and process creation following pickle file loading operations
- Track network connections initiated shortly after pickle deserialization events
How to Mitigate CVE-2025-10157
Immediate Actions Required
- Upgrade picklescan to a version newer than 0.0.30 that includes the security fix
- Review any pickle files that were previously scanned and approved with the vulnerable version
- Consider re-scanning existing pickle files with the patched version before loading
- Implement defense-in-depth controls around pickle file processing
Patch Information
The vulnerability has been addressed by the maintainer. Users should update to the latest version of picklescan that includes the fix for this submodule bypass issue. Details are available in the GitHub Security Advisory.
The fix modifies the module matching logic in scanner.py to properly account for submodule hierarchies when checking against the blocklist of dangerous modules.
Workarounds
- Avoid loading untrusted pickle files entirely until the patch can be applied
- Implement additional validation layers that check for submodule patterns of blocked modules
- Use alternative serialization formats (JSON, Protocol Buffers) that do not support arbitrary code execution
- Run pickle deserialization in isolated sandbox environments with restricted permissions
- Manually audit pickle files for suspicious module references before allowing them through security controls
# Upgrade picklescan to the latest patched version
pip install --upgrade picklescan
# Verify installed version is newer than 0.0.30
pip show picklescan | grep Version
Disclaimer: This content was generated using AI. While we strive for accuracy, please verify critical information with official sources.


