CVE-2025-71376: picklescan Gadget Chain Bypass Allows Undetected Code Execution
picklescan, a Python library designed to detect malicious pickle files before they're loaded, has a critical detection bypass in versions before 0.0.29. Attackers can craft pickle files that hide arbitrary code execution payloads using a specific Python class (idlelib.autocomplete.AutoComplete.fetch_completions) within pickle serialization reduce methods. When a victim loads such a file with picklescan 0.0.28 or earlier, the scanner fails to flag it as dangerous, allowing the embedded malicious code to execute. This is particularly dangerous because pickle files are often used for data persistence, model storage in machine learning workflows, and configuration management—areas where developers might trust scanning tools to catch threats.
Source data · NVD / CISA · public domain
- CVSS
- 3.1 · 8.1 HIGH · CVSS:3.1/AV:N/AC:L/PR:N/UI:R/S:U/C:H/I:H/A:N
- Weaknesses (CWE)
- CWE-502
- Affected products
- 0 configuration(s)
- Published / Modified
- 2026-06-23 / 2026-06-23
NVD description (verbatim)
picklescan before 0.0.29 fails to detect malicious pickle files using idlelib.autocomplete.AutoComplete.fetch_completions in reduce methods. Attackers can embed undetected code in pickle files that executes arbitrary commands when loaded by victims.
3 reference(s) · View on NVD →
SEC.co analysis · AI-assisted, reviewed against source
Technical summary
The vulnerability exploits a gap in picklescan's detection logic for unsafe pickle constructs. Pickle's reduce protocol allows custom classes to define deserialization behavior via the __reduce__ method. picklescan attempts to identify dangerous gadget chains that could enable arbitrary code execution, but it fails to recognize the specific gadget chain using idlelib.autocomplete.AutoComplete.fetch_completions as a code-execution primitive. An attacker can embed this class reference in a crafted pickle file's reduce method, and when the file is deserialized, the fetch_completions method executes, allowing command execution. The root cause is incomplete gadget chain enumeration in picklescan's allowlist/blocklist logic. Exploitation requires the target environment to have idlelib available (standard in most Python installations) and to use the vulnerable picklescan version for threat detection.
Business impact
Organizations relying on picklescan for supply-chain security or untrusted data handling face undetected arbitrary code execution. This is especially critical in data science and ML teams that use pickle for model serialization, build pipelines that deserialize configuration from external sources, or security tools that scan pickle files as part of artifact validation. A successful exploit could lead to unauthorized command execution with the privileges of the Python process, potentially compromising development environments, training infrastructure, or production systems. The breach of detection confidence—where a tool explicitly trusted to catch threats fails silently—raises the risk of post-exploitation dwell time, as compromises may go unnoticed longer.
Affected systems
picklescan versions 0.0.28 and earlier are vulnerable. Any environment running these versions to validate pickle files is at risk. The vulnerability does not directly affect pickle usage itself (Python's pickle module remains vulnerable by design to untrusted data), but rather degrades a key defensive tool. Affected users include those who: deploy picklescan in automated scanning pipelines, use it in security gates for artifact ingestion, rely on it to audit third-party pickle files, or integrate it into CI/CD systems. The actual impact depends on whether picklescan is deployed as a filtering mechanism—if it's informational only, risk is lower; if it gates execution, the bypass directly enables attack.
Exploitability
Exploitability is high. The attack requires only that an attacker craft a malicious pickle file—a task well within reach of anyone familiar with Python's pickle format. No special privileges, authentication, or complex exploit infrastructure are needed. The attacker simply embeds the gadget chain into a pickle file and distributes it (e.g., as a model file, dataset, or config backup). Triggering the payload requires the victim to load the file using vulnerable picklescan; however, since picklescan is often deployed precisely to prevent such scenarios, victims are likely not expecting danger. The barrier to weaponization is low: proof-of-concept gadget chains are straightforward to construct. The only friction is distribution—the file must reach a user who will deserialize it—but this is frequently achievable in open-source dependencies, ML model repositories, or data-sharing workflows.
Remediation
Upgrade picklescan to version 0.0.29 or later immediately. The patched version includes detection for the idlelib.autocomplete.AutoComplete.fetch_completions gadget chain and reinforces the gadget chain detection logic. Beyond patching, adopt defense-in-depth: never deserialize pickle files from untrusted sources, enforce code review for any pickle-based data pipelines, consider migrating to safer serialization formats (JSON, Protocol Buffers, MessagePack) where feasible, and implement sandboxing or containerization for environments that must handle untrusted pickles. For organizations unable to immediately patch, temporarily disable picklescan-based scanning and substitute it with format validation (reject .pickle files at ingress) or use alternative security scanning tools.
Patch guidance
Update picklescan to 0.0.29 or later via your package manager (pip install --upgrade picklescan). Verify the update by checking the installed version: pip show picklescan should report version 0.0.29+. If picklescan is pinned in requirements.txt or lock files, update the constraint to >=0.0.29 and re-lock dependencies. For containerized deployments, rebuild images with the patched version. Test the patched version in a non-production environment first to confirm compatibility with existing scanning workflows; the patch is unlikely to introduce breaking changes, but validation is prudent. Restart any running services or batch jobs that use picklescan after updating.
Detection guidance
Organizations can detect potential exploitation of this vulnerability by monitoring for: (1) Attempts to deserialize pickle files with idlelib imports or references in their structure—use pickle inspection tools to scan for class references before loading; (2) Execution of unexpected subprocesses or system commands from Python processes that handle pickle data; (3) Network connections from Python processes handling pickles, especially to unusual destinations. In logs, search for patterns indicating pickle load operations on untrusted files or from unexpected sources. If picklescan was integrated into a security gate, assume any pickle files scanned by 0.0.28 or earlier are unverified; retrospective scanning of archived files with the patched version may reveal if malicious files were previously missed. Implement inline pickle inspection using safer alternatives like pickletools.dis() to audit structure before deserialization.
Why prioritize this
This vulnerability merits immediate high-priority patching despite modest CVSS (8.1) because it directly undermines a critical defensive tool trusted by security teams. The combination of easy exploitability, silent failure of detection, and broad use of pickle in data workflows creates significant residual risk. The threat is amplified because victims deploying picklescan have explicitly chosen to rely on it for threat detection; the bypass erodes that assurance and likely delays incident response. Organizations in sectors handling untrusted ML models, open-source dependencies, or shared datasets should treat this as critical.
Risk score, explained
CVSS 8.1 (High) reflects the high impact of arbitrary code execution (full confidentiality and integrity loss) accessible over the network with low attack complexity and no privilege escalation or user interaction required for exploitation—only social engineering to get the file loaded. However, the practical risk may be higher for specific organizations: those deploying picklescan as a security boundary face a bypass of a key control; those in supply chains handling models or datasets face heightened risk. Conversely, the score appropriately reflects that the vulnerability requires the target to actually use the vulnerable picklescan version and that pickle usage in untrusted contexts is already a known risk.
Frequently asked questions
If we're not using picklescan, are we vulnerable?
No, not directly from this CVE. However, this vulnerability underscores the broader risk of deserializing untrusted pickle files in Python at all. Python's pickle module is inherently unsafe for untrusted data by design. If you work with pickle, the real mitigation is to avoid untrusted sources or use safer serialization formats. picklescan was a tool to reduce risk, not eliminate it.
Do we need to scan our pickled data retroactively with the patched version?
Yes, if you've used vulnerable picklescan (0.0.28 or earlier) to approve pickle files in the past, those approvals are unreliable. Scan any archived or cached pickle files with the patched version. Pay special attention to model files, datasets, and config files from external sources that were previously cleared by the older scanner.
What if we can't upgrade picklescan immediately due to dependencies?
Temporarily bypass picklescan-based approval and implement alternative controls: (1) reject pickle files at ingress if they're not essential, (2) inspect pickle file structure manually using pickletools.dis() before loading, (3) sandbox pickle deserialization in a containerized environment, (4) use code review to audit any pickle-loading code paths. Plan the upgrade as soon as dependencies allow.
Does the vulnerability affect Python's pickle module itself?
No. Python's pickle is insecure by design for untrusted data—it has always allowed arbitrary code execution. picklescan was a third-party tool attempting to mitigate that. This CVE shows that picklescan had gaps in its mitigation. The solution is not to patch pickle, but to patch picklescan and, ideally, stop using pickle for untrusted data altogether.
This analysis is provided for informational and educational purposes to help security teams understand and respond to CVE-2025-71376. It is not a substitute for vendor advisories, independent security research, or professional security assessment. Organizations should verify all patch versions and technical details against official picklescan release notes and project documentation. The vulnerability description and CVSS score are based on public sources; actual risk in your environment depends on your specific use of picklescan and pickle files. No exploit code or weaponized proof-of-concept is provided herein. Always test patches in non-production environments before deployment. Source: NVD (public-domain), retrieved 2026-07-28. Analysis generated by SEC.co (claude-haiku-4-5).
Weaknesses (CWE)
Related vulnerabilities
- CVE-2025-11993HIGHWooCommerce Infinite Scroll Plugin PHP Object Injection – HIGH Severity
- CVE-2025-27511HIGHGeoServer DB2 JNDI Injection Remote Code Execution
- CVE-2025-69130HIGHPHP Object Injection in Entrepreneur WordPress Booking Theme ≤3.1.3
- CVE-2025-71339HIGHPicklescan Gadget Bypass Allows Arbitrary Code Execution
- CVE-2025-71341HIGHPicklescan Bypass Enables Remote Code Execution via profile.Profile.runctx
- CVE-2025-71344HIGHpicklescan RCE via Undetected ensurepip._run_pip
- CVE-2025-71348HIGHpicklescan Detection Evasion in Torch Config Loading
- CVE-2025-71357HIGHPicklescan Evasion via idlelib.pyshell.ModifiedInterpreter