/

CVE-2025-71367

Severity:

HIGH RISK

(8.1)

Unsafe Deserialization (CWE-502) in picklescan Checks

CVE-2025-71367

Deferred

Vulnerability type

Category:

Unsafe Deserialization

CWE:

CWE-502

Impact:

Arbitrary Code Execution

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

A flaw in picklescan before version 0.0.34 fails to detect the use of _operator.attrgetter in pickle payloads, allowing malicious constructs to slip past its security checks.

Remote attackers can craft pickle files that abuse attrgetter within __reduce__ methods, leading to arbitrary code execution when applications call pickle.load() on untrusted data.

Affected context

This vulnerability appears in environments that rely on picklescan as a defensive layer when working with Python pickle data.

It is especially relevant where applications:

  • Accept or process pickle payloads from external or semi-trusted sources
  • Use picklescan to pre-screen payloads before calling pickle.load()
  • Assume picklescan will reliably detect dangerous constructs and thereby treat screened payloads as safe

The risk arises when _operator.attrgetter is used within __reduce__ implementations to construct execution-capable objects that picklescan fails to flag.

Exploit preconditions

  • Attack surface: Any interface that accepts pickle data and subsequently calls pickle.load() or equivalent deserialization functions.
  • Required access: Ability to supply or influence serialized pickle payloads (e.g., file upload, API input, message queue, or shared storage).
  • Trigger point: Deserialization of the crafted pickle object by an application using the Python pickle module, after the payload has been incorrectly deemed safe by picklescan.
  • Why exploitation is possible: picklescan before 0.0.34 does not recognize _operator.attrgetter-based patterns within __reduce__ that can be chained to execute code, so adversaries can construct payloads that bypass its checks while still leveraging unsafe deserialization semantics.

Why this happens

The underlying bug is an incomplete validation of deserialization constructs within pickle payloads, mapping directly to CWE-502: Unsafe Deserialization.

picklescan's analysis model fails to treat _operator.attrgetter as a potentially dangerous callable in __reduce__ methods, leaving a gap where code-capable object graphs can be constructed without detection.

In abstract terms, the system trusts a partial pattern-matching approach to classify payloads as safe, but the deserialization mechanism (pickle.load) can interpret more complex combinations of callables and state that picklescan does not fully model, enabling arbitrary behavior during object reconstruction.

Potential impact

  • Attackers could achieve arbitrary code execution within the Python process that deserializes the malicious pickle.
  • Malicious payloads can bypass picklescan-based security checks, undermining assumptions of safety and defense-in-depth.
  • An attacker may escalate from data tampering to full compromise of the application environment or host, depending on process privileges.
  • Successful exploitation could lead to data exfiltration, modification of application logic, or deployment of persistence mechanisms within the runtime.

General mitigation guidance

Effective mitigation focuses on both reducing trust in pickle-based data and hardening inspection mechanisms against unsafe deserialization patterns.

Common defensive patterns include:

  • Avoiding pickle for untrusted or cross-boundary data; prefer data-only serialization formats (e.g., JSON, protocol buffers) that do not support executable constructs.
  • Treating any deserialization mechanism as a potential execution vector and enforcing strict boundaries around what data can be deserialized and where it originates.
  • Applying a deny-by-default policy in payload analysis tools: explicitly model and block callable objects and reduction patterns that can lead to code execution, rather than relying on incomplete allow-lists.
  • Running deserialization logic in processes with minimal privileges, strong isolation, and limited filesystem or network access to reduce blast radius if unsafe payloads slip through.
  • Incorporating schema validation or structural constraints for serialized data, ensuring application logic cannot load arbitrary objects without verification of type and content.

How teams detect issues like this

Organizations can approach detection by combining static and dynamic scrutiny of code and its deserialization practices:

  • Static analysis rules to flag use of pickle.load, pickle.loads, or similar APIs, especially on data originating from untrusted channels, and require review or justification.
  • Code review checklists that highlight assumptions around picklescan or similar tools, ensuring developers understand these are advisory filters rather than absolute safety guarantees.
  • Policy-based controls in CI/CD pipelines that detect deserialization of attacker-controlled data, and that track the introduction of new callable patterns or helper functions used in __reduce__ implementations.
  • Runtime monitoring for suspicious deserialization behavior, such as unusual file access, process creation, or module imports occurring immediately after loading serialized objects.
  • Optionally, use automated security scanners or linters configured with custom rules for pickle usage and unsafe deserialization constructs, including functions like _operator.attrgetter and other callable helpers.

Sources

SourceLink
github.comgithub.com/mmaitre314/picklescan/security/advisories/GHSA-46h3-79wf-xr6c
vulncheck.comvulncheck.com/advisories/picklescan-remote-code-execution-via-operator-attrgetter-detection-bypass

Frequently asked

questions

Exploitability depends on whether an application deserializes attacker-controlled pickle data and relies on picklescan for safety. In those contexts, a remote attacker can craft payloads that bypass checks and trigger arbitrary code execution.

An attacker needs the ability to supply or influence pickle payloads processed by the target application. This might be through file uploads, inter-service messages, or any interface that accepts serialized Python objects.

The safest approach is to avoid using pickle for data that comes from outside trusted boundaries. Where deserialization is unavoidable, treat it as a high-risk operation, enforce strict constraints on what can be deserialized, and strengthen detection tools to block all execution-capable constructs.

Design systems so that data interchange uses non-executable, schema-driven formats. Establish architectural guidelines that forbid unsafe deserialization for untrusted inputs, and integrate security reviews, static analysis, and policy enforcement around any introduction of serialization frameworks that support arbitrary object reconstruction.

Find out what's already
exploitable in your codebase.