/

CVE-2025-71365

Severity:

HIGH RISK

(8.1)

Unsafe Deserialization (CWE-502) in picklescan Scanner

CVE-2025-71365

Deferred

Vulnerability type

Category:

Unsafe Deserialization

CWE:

CWE-502

Impact:

Remote Code Execution via bypassed pickle scanning

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 files can bypass detection in affected versions of picklescan by invoking numpy.f2py.crackfortran.myeval via the __reduce__ method.

When such crafted pickle payloads are later loaded by an application, they can execute arbitrary code despite having previously passed picklescan checks, creating a high-risk remote code execution scenario.

Affected context

This vulnerability appears in environments that rely on picklescan (before 0.0.33) as a security gate for inspecting Python pickle files.

It is most relevant where:

  • Untrusted or semi-trusted pickle data is accepted from external sources
  • picklescan is integrated into upload pipelines, artifact validation, or security reviews
  • Downstream systems assume that "scan passed" implies pickle safety and subsequently perform pickle.load or equivalent deserialization.

Exploit preconditions

  • Attack surface: Any workflow that ingests attacker-controlled pickle files and uses picklescan to assess their safety.
  • Required access: Ability to submit or influence serialized pickle content (e.g., file uploads, data streams, shared artifacts).
  • Trigger point: A vulnerable version of picklescan analyzes the malicious pickle, fails to flag it, and an application later deserializes the payload.
  • Why exploitation is possible: The scanner's detection logic does not recognize dangerous use of numpy.f2py.crackfortran.myeval invoked via the pickle __reduce__ mechanism, allowing arbitrary code execution during deserialization while appearing benign at scan time.

Why this happens

The core issue stems from incomplete coverage of dangerous deserialization behaviors in picklescan's analysis engine.

Under CWE-502, unsafe deserialization occurs when untrusted data is converted back into objects that can trigger execution paths; here, the pickle protocol's __reduce__ hook is used to invoke numpy.f2py.crackfortran.myeval, a function capable of evaluating arbitrary code.

Because picklescan focuses on known risky constructs but lacks specific rules for this invocation pattern, crafted payloads evade detection, undermining the tool's role as a protective control.

Potential impact

  • Arbitrary code execution in the process that deserializes the malicious pickle file
  • Compromise of application servers or data processing workers
  • Exfiltration or tampering of sensitive in-memory data handled post-deserialization
  • Installation of backdoors or malware in environments where pickle files are routinely loaded
  • Lateral movement within the infrastructure if compromised processes hold elevated privileges

General mitigation guidance

Secure patterns revolve around reducing trust in serialized data and strengthening deserialization controls rather than depending solely on a single scanner.

Common mitigation strategies include:

  • Treating all pickle input as untrusted and avoiding deserialization for user-supplied content wherever feasible.
  • Preferring safer, schema-based serialization formats (e.g., JSON, MessagePack, Protobuf) that lack executable semantics.
  • Applying strict allowlists for modules and callables that can be reconstructed during deserialization, or disabling custom __reduce__ behavior in critical code paths.
  • Running deserialization logic in isolated, least-privilege contexts to limit blast radius if malicious payloads are processed.
  • Complementing static scanners with defense-in-depth controls such as runtime sandboxing, OS-level access restrictions, and robust logging around deserialization events.

How teams detect issues like this

High-level detection focuses on both identifying unsafe pickle usage and verifying the completeness of scanning rules.

Possible approaches include:

  • Static analysis checks for calls to pickle.load, pickle.loads, or similar APIs where data originates from external or untrusted sources.
  • Code review practices that flag reliance on picklescan (or any single tool) as a sole safety guarantee and look for dangerous function references like numpy.f2py.crackfortran.myeval in serialization-related code.
  • Security policies that require schema-based formats for cross-boundary data exchange and mandate explicit documentation of any remaining pickle-based protocols.
  • Periodic evaluation of deserialization scanners against curated test suites of malicious payloads to confirm coverage and catch bypasses.
  • Optional use of automated SAST/DAST tools configured with rules for CWE-502 patterns to continuously monitor repositories and pipelines.

Sources

SourceLink
github.comgithub.com/mmaitre314/picklescan/security/advisories/GHSA-3329-ghmp-jmv5
vulncheck.comvulncheck.com/advisories/picklescan-arbitrary-code-execution-via-numpy-f2py-crackfortran-myeval-detection-bypass

Frequently asked

questions

Yes, if an application accepts pickle files or pickle-encoded data from remote sources and uses picklescan to vet them before deserializing, attackers can deliver malicious payloads that pass scanning and achieve remote code execution upon load.

The attacker must be able to supply or influence serialized pickle data consumed by the target system. No direct code execution access is required initially; the deserialization step provides the execution pathway once the crafted file is processed.

The most robust fix is to avoid using pickle for untrusted data entirely and migrate to non-executable, schema-driven formats. Where pickle is unavoidable, enforce allowlisted deserialization behavior, isolate the runtime, and do not rely solely on scanners for safety guarantees.

To prevent similar problems, establish organizational standards that limit or ban unsafe deserialization for cross-boundary data, integrate static analysis focused on CWE-502 into CI pipelines, regularly test security tools against adversarial payloads, and design systems under the assumption that scanners may be bypassed, using multiple layers of controls to protect deserialization workflows.

Find out what's already
exploitable in your codebase.