/

CVE-2025-71370

Severity:

HIGH RISK

(8.1)

Deserialization Bypass (CWE-502) in picklescan Scanner

CVE-2025-71370

Deferred

Vulnerability type

Category:

Unsafe Deserialization

CWE:

CWE-502

Impact:

Remote Code Execution via detection bypass

Severity:

HIGH RISK

(8.1)

CVSS version:

3.1

Catch this CVE while code is being written

Detect vulnerable code directly in pull requests, so CVEs are fixed before merge.

Summary

Malicious pickle payloads can evade detection in vulnerable versions of picklescan by abusing unsupported torch.jit tensor operations.

When these crafted files are later deserialized with pickle.load(), they can execute arbitrary code, making any workflow that relies on picklescan for safety exposed to hidden RCE risk.

Affected context

This vulnerability appears in environments that rely on picklescan as a security filter for untrusted or semi-trusted pickle files, especially in Python ML or data pipelines using PyTorch.

It manifests where pickle files are accepted from external sources, scanned with picklescan, and then loaded with pickle.load() under the assumption that picklescan will block dangerous content.

The issue is specifically tied to malformed payloads that embed torch.jit.unsupported_tensor_ops.execWrapper calls, which picklescan fails to recognize as malicious.

Exploit preconditions

  • Attack surface: Any service, script, or pipeline that ingests pickle files, uses picklescan for vetting, and then calls pickle.load() on "approved" files.
  • Required access: Ability to supply or influence pickle files processed by the environment (e.g., file uploads, model sharing, cached artifacts, shared storage).
  • Trigger point: Deserialization occurs when pickle.load() is invoked on a payload that previously passed picklescan scanning.
  • Why exploitation is possible: picklescan's detection logic does not treat torch.jit.unsupported_tensor_ops.execWrapper as a dangerous construct, allowing attackers to embed executable behaviors that trigger during unpickling.

Why this happens

The underlying issue is an incomplete unsafe deserialization defense: picklescan assumes it can identify and block all dangerous pickle constructs but has gaps in its recognition logic.

Specifically, support for PyTorch's torch.jit.unsupported_tensor_ops.execWrapper is missing from the rule set, so deserialization payloads using this mechanism slip through without being flagged as malicious.

This maps to CWE-502 (Unsafe Deserialization), where untrusted serialized data is allowed to instantiate objects or run logic during deserialization, combined with an overreliance on a partial detection tool as a trust boundary.

Potential impact

  • Arbitrary code execution when an attacker-controlled pickle file is deserialized.
  • Compromise of applications or services that load scanned pickle files.
  • Unauthorized access to sensitive data and secrets available to the deserializing process.
  • Lateral movement within the host or environment where the vulnerable process runs.
  • Data corruption or poisoning of machine learning models and datasets.

General mitigation guidance

Effective mitigation centers on reducing trust in pickle-based inputs and enforcing strict deserialization boundaries.

Common defensive patterns include:

  • Treating all pickle data as untrusted and avoiding automatic deserialization in security-sensitive contexts.
  • Replacing pickle with safer, schema-driven serialization formats (e.g., JSON, MsgPack, or protocol buffers) for externally supplied data.
  • Wrapping any unavoidable pickle.load() calls in highly constrained, least-privilege environments (e.g., sandboxed workers, separate OS users, reduced filesystem and network capabilities).
  • Applying allowlist-based object deserialization strategies where only explicitly permitted types and modules can be instantiated.
  • Using multiple, complementary validation checks instead of relying on a single scanner as a hard security boundary.

How teams detect issues like this

Detection typically involves both static and dynamic analysis of how serialization is used in the codebase:

  • Static analysis rules that flag calls to pickle.load(), torch.load(), or related APIs when used on data from untrusted or semi-trusted sources.
  • Code review practices that question any workflow relying on picklescan or similar tools as the primary protection against malicious payloads.
  • Policy checks in CI/CD to enforce serialization guidelines, such as "no pickle for user-supplied data" or "pickle only in isolated workers."
  • Runtime monitoring and logging around deserialization pathways to detect unusual imports, subprocess spawning, or file/network activity during unpickling.
  • Optional use of automated security scanners that understand unsafe deserialization patterns and PyTorch-specific exec-style constructs.

Sources

SourceLink
github.comgithub.com/mmaitre314/picklescan/security/advisories/GHSA-vr7h-p6mm-wpmh
vulncheck.comvulncheck.com/advisories/picklescan-remote-code-execution-via-torch-jit-unsupported-tensor-ops-execwrapper

Frequently asked

questions

Yes, if an attacker can remotely submit or influence pickle files that are scanned by picklescan and then loaded via pickle.load(), they can potentially achieve remote code execution within the deserializing process.

The attacker needs the ability to provide pickle files to the affected system—through uploads, shared storage, artifact sharing, or any integration that accepts serialized models or data—and rely on the system to load them after picklescan approval.

The safest pattern is to avoid using pickle for untrusted data entirely, switching to safer, schema-based formats and isolating any remaining deserialization in low-privilege, sandboxed execution contexts. Complementary checks should be used instead of assuming a single scanner fully neutralizes deserialization risk.

Future systems should treat serialization/deserialization as a high-risk boundary, avoid general-purpose object serialization for data crossing trust boundaries, enforce strict allowlists and schemas, and embed deserialization guidance into coding standards, code review practices, and CI/CD policies.

Find out what's already
exploitable in your codebase.