/

CVE-2026-53874

Severity:

CRITICAL RISK

(9.8)

Unsafe Pickle Deserialization (CWE-502) in picklescan

CVE-2026-53874

Deferred

Vulnerability type

Category:

Unsafe Deserialization

CWE:

CWE-502

Impact:

Remote Code Execution

Severity:

CRITICAL RISK

(9.8)

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

picklescan before 1.0.1 contains an unsafe pickle deserialization flaw that allows attackers to hide eval-based payloads inside callable objects accessed via getattr.

When applications rely on picklescan to vet untrusted pickle files, malicious code can bypass detection and execute during pickle loading, leading to remote code execution.

Affected context

This vulnerability affects environments where picklescan is used to assess or filter pickle files, especially in workflows that presume its checks are sufficient to treat pickles as safe.

The risk is elevated when:

  • Pickle data originates from untrusted or semi-trusted sources (e.g., user uploads, external services, shared datasets)
  • Applications automatically load or unpickle data after scanning
  • Security decisions rely on picklescan's ability to detect dangerous constructs rather than treating all pickles as untrusted code

Exploit preconditions

  • Attack surface: Any application or service that processes untrusted pickle files and uses picklescan for safety checks.
  • Required access: Ability to supply or influence pickle content (e.g., file upload, API input, shared storage).
  • Trigger point: The vulnerable pickle is loaded/unpickled after being scanned and incorrectly deemed safe.
  • Why exploitation is possible: picklescan's detection logic can be bypassed by nesting eval-like behavior under callable objects accessed via getattr, allowing dangerous operations to be hidden from the scanner while remaining executable during deserialization.

Why this happens

The issue stems from incomplete modeling of Python pickle execution semantics within picklescan's analysis logic.

While the tool attempts to identify dangerous patterns (such as eval calls), it does not fully account for indirection via callable objects and getattr chains, allowing attackers to conceal malicious behavior.

This aligns with CWE-502: Unsafe Deserialization, where untrusted serialized data is treated as safe because security controls focus on limited patterns rather than adopting a strict "code execution by design" posture for the format.

Potential impact

  • Remote code execution within the context of the process that loads the pickle
  • Compromise of application data, including reading or modifying sensitive information
  • Deployment of backdoors or persistence mechanisms on affected hosts
  • Lateral movement within the environment using the compromised application as a foothold
  • Abuse of available credentials, API keys, or cloud metadata accessible to the process

General mitigation guidance

Effective mitigation focuses on treating pickle as inherently unsafe and reducing trust in security scanning alone.

Recommended defensive patterns include:

  • Avoiding pickle for data interchange across trust boundaries; prefer safer, non-executable formats (e.g., JSON, MessagePack, Protobuf) where feasible.
  • Treating all pickle data as potentially malicious and only loading it from fully trusted, controlled sources.
  • Isolating any unavoidable pickle deserialization in hardened sandboxes or constrained worker processes with minimal privileges and no access to secrets.
  • Applying strict input validation and whitelisting for allowed object types or modules when using custom reducers or restricted unpicklers.
  • Designing systems so that security does not depend solely on static scanners; layering runtime controls such as SELinux, AppArmor, or container isolation to limit blast radius.

How teams detect issues like this

Detection strategies should combine code-level review with architectural checks:

  • Use static analysis and code search to identify all usage of pickle, cPickle, dill, or similar serialization libraries, especially where data originates from external inputs.
  • Review application flows where picklescan results are used as a gate to decide whether deserialization is "safe," and flag any automatic unpickling based solely on scanner output.
  • Incorporate security reviews that question why pickle is needed and verify that unpickling only occurs in trusted contexts or isolated components.
  • Consider integrating automated security testing (SAST/DAST) that looks for unsafe deserialization patterns and policy violations (e.g., "no unpickling of user-controlled data").

Sources

SourceLink
github.comgithub.com/mmaitre314/picklescan/security/advisories/GHSA-9m3x-qqw2-h32h
vulncheck.comvulncheck.com/advisories/picklescan-arbitrary-code-execution-via-obfuscated-eval-call

Frequently asked

questions

Yes, if an attacker can cause an application to process a crafted pickle file sourced from a remote or untrusted origin and that application relies on picklescan before unpickling.

The attacker generally needs only the ability to supply or influence a pickle file (such as via file upload, API parameter, shared storage, or data pipeline input); direct system access is not required.

The safest pattern is to avoid using pickle for any data that crosses trust boundaries and to stop treating picklescan (or any scanner) as a guarantee of safety; use non-executable data formats and restrict deserialization to trusted sources or isolated components.

Establish a design rule that executable serialization formats (like pickle) are not used for untrusted data, regularly audit code for deserialization primitives, and enforce policies in code review and CI pipelines that require safer formats or strict isolation when deserialization is unavoidable.

Find out what's already
exploitable in your codebase.