HIGH 8.1

CVE-2025-71356: Picklescan Bypass via PyTorch ShapeEnv—Remote Code Execution in Pickle Files

Picklescan, a tool designed to detect malicious code in Python pickle files, has a critical blind spot. Versions before 0.0.28 fail to recognize a specific attack pattern involving PyTorch's symbolic shape evaluation function. Attackers can weaponize this gap by embedding code that looks clean to picklescan but executes arbitrary commands when the pickle file is opened—a classic remote code execution scenario that puts any organization deserializing untrusted pickles at serious risk.

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-07-04 / 2026-07-06

NVD description (verbatim)

picklescan before 0.0.28 fails to detect malicious torch.fx.experimental.symbolic_shapes.ShapeEnv.evaluate_guards_expression function calls in pickle files. Attackers can embed undetected code in pickle files that executes remote code when loaded by victims.

3 reference(s) · View on NVD →

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

Technical summary

CVE-2025-71356 exploits an unsafe deserialization vulnerability in picklescan's inspection logic. The vulnerability stems from insufficient detection coverage of torch.fx.experimental.symbolic_shapes.ShapeEnv.evaluate_guards_expression function calls within pickle bytecode. When a victim loads a malicious pickle file using Python's pickle module (or compatible libraries), the crafted ShapeEnv.evaluate_guards_expression invocation bypasses picklescan's scanning heuristics and executes attacker-controlled code in the context of the unpickling process. The root cause is CWE-502 (Deserialization of Untrusted Data), where the detection mechanism does not maintain a comprehensive allowlist or blocklist for all dangerous callable types.

Business impact

Organizations relying on picklescan to safely process pickle files from external or semi-trusted sources face a material compromise of that security boundary. If picklescan was deployed as a gatekeeper before loading pickles from APIs, cloud storage, or third-party data pipelines, an attacker can circumvent it entirely. The impact extends to any data science or machine learning workflow that deserializes models, datasets, or intermediate artifacts in pickle format. A successful exploit grants the attacker the same privileges as the process loading the pickle, potentially enabling data exfiltration, lateral movement, or supply chain infection if the compromised system has further downstream access.

Affected systems

Any system using picklescan versions prior to 0.0.28 is vulnerable if it processes pickle files from untrusted or partially-trusted sources. This includes data science teams using picklescan to validate model checkpoints, data ingestion pipelines that scan incoming serialized Python objects, and security teams using picklescan as part of artifact scanning workflows. PyTorch users who rely on picklescan to vet model files are particularly exposed, given the attack vector's reliance on a PyTorch-specific function. The vulnerability does not affect picklescan installations already running version 0.0.28 or later.

Exploitability

Exploitation requires two preconditions: the attacker must be able to craft and deliver a malicious pickle file to a victim, and the victim must load that file using a system running vulnerable picklescan (or no security scanning at all). The attack does not require authentication, special network conditions, or complex social engineering—a pickle file can be embedded in an email, hosted on a web server, or injected into a data pipeline. Once the malicious pickle reaches a process with deserialization permissions, code execution is immediate and reliable. The CVSS score of 8.1 reflects this combination of network accessibility, low complexity, and no privilege escalation requirement, offset only by the user interaction requirement (the victim must explicitly deserialize the pickle).

Remediation

Upgrade picklescan to version 0.0.28 or later immediately. This patched version includes enhanced detection logic that covers torch.fx.experimental.symbolic_shapes.ShapeEnv.evaluate_guards_expression calls and likely other previously-missed callable types. In parallel, adopt defense-in-depth practices: (1) avoid deserializing pickle files from untrusted sources when possible; (2) use safer serialization formats (JSON, Protocol Buffers, MessagePack) for data exchange; (3) enforce sandboxing or containerization around any pickle deserialization; (4) implement network segmentation to limit lateral movement if code execution occurs.

Patch guidance

Apply the upgrade to picklescan 0.0.28 or later across all systems where the tool is deployed. Prioritize systems that process externally-sourced pickle files or are exposed to multi-tenant environments. Verify the upgrade by checking the installed version (e.g., `pip show picklescan` or similar package manager command) and confirm that your deployment reflects the patched version. If picklescan is integrated into a larger CI/CD or scanning pipeline, ensure the upgrade is reflected in container images, requirements files, and dependency manifests before rolling out to production. Test the updated scanner on known-malicious pickle samples if available to confirm detection improvements.

Detection guidance

Monitor for attempted deserialization of pickle files in production environments, particularly if they originate from external sources. Look for process execution or unusual activity immediately following pickle deserialization events. If you suspect a malicious pickle was processed before the patch, review process logs, network connections, and file modifications that occurred during or shortly after the deserialization. File integrity monitoring on pickle artifacts and access logs to model storage can help identify tampering. Consider implementing a blocklist of known-malicious pickle hashes alongside picklescan to catch signatures of actively-exploited samples.

Why prioritize this

This vulnerability merits immediate attention because it directly undermines a tool that many organizations trust as a security control. The high CVSS score (8.1) reflects the severity of remote code execution combined with low barriers to exploitation. The attack surface is broad for anyone using picklescan in production, and the failure mode—silent bypassing of the scanner—means that compromised systems may not be detected until damage has occurred. Patching is straightforward and low-risk, making it a high-return security action.

Risk score, explained

The CVSS 3.1 score of 8.1 (HIGH) is justified by: (1) Network accessibility (AV:N) and low attack complexity (AC:L)—the attacker needs only to deliver a pickle file; (2) no privilege escalation or special conditions required (PR:N); (3) high confidentiality and integrity impact (C:H, I:H)—code execution grants access to sensitive data and system modification; (4) no availability impact (A:N) unless the attacker chooses to halt the process; (5) user interaction required (UI:R)—the victim must deserialize the pickle. The score reflects a realistic threat scenario where an attacker delivers a weaponized pickle file and a user or automated system loads it without realizing the scanner has been bypassed.

Frequently asked questions

Can picklescan 0.0.27 and earlier still be used if we never deserialize untrusted pickle files?

In theory, yes—the vulnerability only manifests if an attacker can inject a malicious pickle into your workflow. However, the definition of 'untrusted' can shift over time (supply chain compromise, compromised internal systems, data pipeline tampering). Upgrade anyway, as the patch is low-risk and provides defense against evolving threats. Picklescan is designed for defense-in-depth; using an outdated version undermines that philosophy.

Does this vulnerability affect the pickle module itself, or only picklescan?

The vulnerability is specific to picklescan's detection logic, not Python's pickle module. Python's pickle is inherently unsafe for untrusted input—that's why picklescan exists. This CVE means picklescan's safety net has a hole. You should never rely solely on picklescan or any single scanner; always apply layered defenses and prefer safer serialization formats when possible.

Are other deserialization scanners vulnerable to the same bypass?

Possibly. The attack vector (torch.fx.experimental.symbolic_shapes.ShapeEnv.evaluate_guards_expression) is specific, but the underlying weakness—incomplete callable detection—is a common challenge in deserialization scanning. Review the detection rules of any scanner you use and consider maintaining a community-sourced blocklist of dangerous callable patterns.

What should we do if we suspect a malicious pickle was processed before we patched picklescan?

Assume potential code execution and initiate incident response: (1) isolate affected systems; (2) review logs for suspicious process execution, network connections, or privilege escalation around the time of deserialization; (3) check for data exfiltration or persistence mechanisms; (4) engage forensics if the system is critical or handled sensitive data. Do not rely on picklescan's absence of a warning to conclude the pickle was benign.

This analysis is based on publicly disclosed vulnerability data current as of the publication date. Security landscapes evolve; verify all version numbers, vendor advisories, and patch availability against authoritative sources before making deployment decisions. This content is educational and does not constitute legal, compliance, or professional security advice. Organizations must conduct their own risk assessments and testing before applying patches or security controls in production environments. SEC.co makes no warranties regarding the completeness or accuracy of this intelligence relative to your specific infrastructure or threat model. Source: NVD (public-domain), retrieved 2026-08-12. Analysis generated by SEC.co (claude-haiku-4-5).