HIGH 8.1

CVE-2025-71371: picklescan Detection Bypass via code.InteractiveInterpreter.runcode

picklescan is a Python library designed to scan pickle files for malicious code before they're deserialized. A vulnerability in versions before 0.0.29 allows attackers to craft specially-crafted pickle payloads that evade picklescan's detection by using code.InteractiveInterpreter.runcode in reduce methods. When a user loads such a malicious pickle file, arbitrary code executes despite the file passing picklescan validation. This creates a false sense of security for teams relying on picklescan to vet untrusted pickle data.

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-30 / 2026-07-01

NVD description (verbatim)

picklescan before 0.0.29 fails to detect malicious pickle files using code.InteractiveInterpreter.runcode in reduce methods. Attackers can craft pickle payloads that bypass picklescan detection and execute arbitrary code when loaded via pickle.load().

3 reference(s) · View on NVD →

SEC.co analysis · AI-assisted, reviewed against source

Technical summary

CVE-2025-71371 exploits a detection gap in picklescan's static analysis of pickle opcodes. The vulnerability leverages the code.InteractiveInterpreter.runcode construct within pickle reduce methods—a serialization pattern that picklescan fails to properly identify as dangerous. Pickle's reduce protocol allows objects to specify custom deserialization logic; by embedding runcode calls in this context, attackers can instantiate arbitrary Python code execution paths that bypass picklescan's inspection heuristics. The issue is classified as CWE-502 (Deserialization of Untrusted Data), a well-known vector for arbitrary code execution in Python environments.

Business impact

Organizations using picklescan as a primary defense against malicious pickle files face a critical trust boundary failure. Any system that accepts pickled data from external sources—including data pipelines, ML model repositories, configuration files, or inter-service RPC calls—becomes vulnerable if picklescan is the sole validation layer. An attacker can deliver a weaponized pickle file that appears safe to security scanning but executes attacker-controlled code upon loading, potentially leading to data exfiltration, lateral movement, supply chain compromise, or system takeover depending on the privileges of the Python process consuming the pickle.

Affected systems

Any deployment running picklescan versions prior to 0.0.29 is affected. The vulnerability applies regardless of operating system. Impact depends on where picklescan is deployed: development environments, CI/CD pipelines, data processing workflows, or production services that deserialize untrusted pickle data. Python environments relying on picklescan as a gating mechanism for model loading, configuration ingestion, or data serialization are at highest risk.

Exploitability

Exploitability is straightforward. An attacker needs only to craft a pickle payload using code.InteractiveInterpreter.runcode in a reduce method and deliver it to a target that validates it with vulnerable picklescan before deserialization. The CVSS vector reflects network attack feasibility (AV:N), low attack complexity (AC:L), no privilege requirement (PR:N), and a user interaction requirement (UI:R)—meaning the victim must take an action to load the pickle file, such as downloading a model or processing a serialized data object. No special exploit infrastructure is needed; the attack is inherent to the pickle format itself.

Remediation

Upgrade picklescan to version 0.0.29 or later. After patching, audit any pickle files that were validated by older versions and consider re-validating them with the patched version. Additionally, evaluate whether picklescan is sufficient as a standalone defense: defense-in-depth strategies should include sandboxing pickle deserialization, running Python processes with minimal privileges, and limiting pickle usage to trusted internal sources where possible. Consider alternative serialization formats (JSON, MessagePack, Protocol Buffers) for new systems to reduce reliance on pickle deserialization altogether.

Patch guidance

Update picklescan to version 0.0.29 or later. Verify the update through your package manager (pip, conda, etc.) and confirm the installed version matches the fixed release. Test the patched version in a non-production environment first to ensure compatibility with your workflow. Once deployed, the updated picklescan should correctly identify and reject pickle payloads using code.InteractiveInterpreter.runcode in reduce methods.

Detection guidance

Identify all systems running picklescan and their versions using dependency scanning tools or package audits. Look for pickle deserialization operations in your codebase and verify they are protected by picklescan validation. If picklescan is used, audit logs or monitoring can detect unusual code execution patterns following pickle loading. For threat hunting: search for pickle files originating from external sources, unusual reduce methods in pickle opcodes, or references to code.InteractiveInterpreter.runcode in serialized Python data. Monitor Python interpreter logs for unexpected code execution from untrusted input sources.

Why prioritize this

This vulnerability merits immediate attention because it directly bypasses a security tool that organizations trust to prevent arbitrary code execution. The CVSS score of 8.1 reflects high impact (confidentiality and integrity), network accessibility, and low attack complexity. While it requires user interaction (loading a file), the interaction is passive from the user's perspective—they may simply open a model, load a config, or process a data file without realizing they're deserializing malicious code. Any organization using picklescan for validation should treat this as a critical update, particularly if pickle files cross trust boundaries.

Risk score, explained

CVSS 3.1 score of 8.1 (HIGH) is justified by: (1) High confidentiality impact—code execution allows data exfiltration; (2) High integrity impact—attacker can modify system state and data; (3) Network attack vector—malicious pickles can be delivered remotely; (4) Low attack complexity—no special conditions needed; (5) No privilege requirement; (6) User interaction required—victim must load the pickle, though this may be an automated process. Availability is not directly impacted (hence no A:H), though secondary effects could occur. The score appropriately reflects that this is a critical remote code execution flaw in a security-sensitive component.

Frequently asked questions

Does this vulnerability affect all Python pickle usage or only picklescan?

The vulnerability is specific to picklescan's detection logic. The underlying pickle format itself has always supported dangerous operations like code execution. picklescan is a tool designed to identify and block such operations before deserialization. This vulnerability means picklescan fails to catch one particular pattern—code.InteractiveInterpreter.runcode in reduce methods—so malicious pickles can evade its checks. If you're not using picklescan, you have no false sense of security from this bug, but you should never deserialize untrusted pickle data regardless.

If we upgrade picklescan to 0.0.29, do we need to re-validate old pickle files?

Yes, you should consider re-validating any pickle files that were accepted by older picklescan versions, especially those from external sources or crossing trust boundaries. The upgraded version will now correctly identify malicious patterns that earlier versions missed. Any files that should have been flagged as dangerous may still be stored in your systems. Evaluate your pickle storage and archive for potentially dangerous files, and where possible, re-run them through the patched picklescan or discard them.

What's the relationship between this vulnerability and supply chain security?

If you consume pre-trained ML models, data artifacts, or configurations serialized in pickle format from third parties (model registries, open-source repositories, data sources), a compromised or malicious upstream could deliver a weaponized pickle that passes picklescan validation before the patch. This makes picklescan a critical link in your supply chain trust model. Upgrading is essential, but also consider verifying pickles against cryptographic signatures from trusted publishers and using sandboxed deserialization for high-risk models.

Can we continue using picklescan as our sole defense for pickle deserialization?

picklescan is a valuable tool but should be part of a defense-in-depth strategy, not the only layer. Even with the fix, picklescan is a detection tool that could have additional bypasses. Best practices include: running pickle deserialization in sandboxed or containerized environments with minimal privileges, using alternative serialization formats where possible, validating pickle sources cryptographically, and monitoring for suspicious code execution patterns. For maximum safety, avoid deserializing untrusted pickle data entirely.

This analysis is based on the CVE record and available technical information as of the publication date. No exploit code or weaponized proof-of-concept is provided. Organizations should verify patch availability and compatibility with their specific deployments against the official picklescan repository and release notes. This vulnerability requires user interaction (loading a pickle file), but that interaction may be implicit in automated workflows. The information herein is for educational and defensive purposes. Always test patches in non-production environments before deployment. Source: NVD (public-domain), retrieved 2026-08-09. Analysis generated by SEC.co (claude-haiku-4-5).