/

CVE-2025-71358

Severity:

HIGH RISK

(8.1)

Pickle Deserialization Bypass (CWE-502) in picklescan

CVE-2025-71358

Deferred

Vulnerability type

Category:

Unsafe Deserialization

CWE:

CWE-502

Impact:

Remote Code Execution via Malicious Pickle Payloads

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 deserialization bypass in picklescan before 0.0.29 fails to detect malicious pickle payloads that abuse idlelib.autocomplete.AutoComplete.get_entity in __reduce__ methods.

This allows attackers to hide arbitrary command execution code in pickle files that appear clean to picklescan and trigger when victims load them with pickle.load().

Affected context

This issue affects workflows and systems that rely on picklescan as a security control to vet untrusted or semi-trusted pickle files before loading them.

It becomes relevant wherever Python's pickle.load() is used on data received from external sources, shared artifacts, or supply-chain components, with the assumption that picklescan will flag dangerous payloads.

The vulnerability specifically involves payloads that exploit idlelib.autocomplete.AutoComplete.get_entity in __reduce__-based gadgets to achieve code execution while remaining undetected by the scanning logic.

Exploit preconditions

  • Attack surface: Any application, toolchain, or workflow that:
  • Accepts pickle files from external or untrusted sources, and
  • Uses picklescan (prior to 0.0.29) as a gatekeeper before calling pickle.load().
  • Required access: Ability to supply or influence a pickle file that will be scanned by picklescan and later deserialized by a victim.
  • Trigger point: The vulnerable pickle is passed to Python's pickle.load() or equivalent APIs in an environment where idlelib.autocomplete.AutoComplete.get_entity is importable.
  • Why exploitation is possible: picklescan's detection logic does not recognize this particular gadget chain using AutoComplete.get_entity in __reduce__, so the malicious payload is not flagged and proceeds to execution upon deserialization.

Why this happens

The root cause lies in incomplete coverage of deserialization gadgets in a security scanning tool that is intended to detect dangerous pickle constructs.

Under CWE-502 (Unsafe Deserialization), the general problem is that data serialized with pickle can carry executable behavior through __reduce__ and related mechanisms.

In this case, picklescan's heuristic or rule-based detection does not account for the use of idlelib.autocomplete.AutoComplete.get_entity as a code execution primitive, allowing attackers to construct payloads that bypass the scanner's expectations and still execute commands when deserialized.

Potential impact

  • Attackers may execute arbitrary system commands in the context of the application loading the pickle.
  • Compromise of local environments, CI/CD agents, or data-science notebooks that process shared pickle artifacts.
  • Theft, modification, or destruction of data accessible to the deserializing process.
  • Use of compromised hosts as a foothold for lateral movement within a network.

General mitigation guidance

Mitigation typically involves treating pickle deserialization as inherently high risk and reducing trust in serialized data.

Common defensive patterns include:

  • Avoiding pickle for untrusted or user-supplied data; prefer safer, data-only formats such as JSON or message-pack where possible.
  • Restricting which code paths and modules are available during deserialization, for example by performing deserialization in an isolated, locked-down environment.
  • Implementing strict allowlists of acceptable classes or data structures when deserialization cannot be avoided.
  • Incorporating multiple layers of defense, such as content validation, least-privilege execution contexts, and network segmentation, so that a deserialization failure is less likely to lead to full system compromise.

How teams detect issues like this

Detection can focus on both code and operational behavior.

At the code level:

  • Use static analysis or code review to identify any use of pickle.load, pickle.loads, or equivalent APIs on data that may originate from external sources.
  • Flag patterns where security tools (like picklescan) are treated as the sole control for validating untrusted pickles.

At the operational level:

  • Monitor for unusual command executions or process trees originating from services that deserialize pickles.
  • Apply security testing to attempt known gadget-based payloads and confirm whether existing scanning and sandboxing controls detect or contain them.

Automated review tools and CI policies can help enforce rules around where and how deserialization is permitted.

Sources

SourceLink
github.comgithub.com/mmaitre314/picklescan/security/advisories/GHSA-6w4w-5w54-rjvr
vulncheck.comvulncheck.com/advisories/picklescan-remote-code-execution-via-idlelib-autocomplete-autocomplete-get-entity

Frequently asked

questions

It can be, if an application or workflow accepts pickle files from remote users or external systems and processes them after scanning with picklescan. The attacker's reach depends on where the pickle is consumed (e.g., web service, API, CI pipeline, or shared artifact repository).

The attacker must be able to provide or influence a pickle file that will be scanned with an affected version of picklescan and then deserialized with pickle.load() in an environment where the underlying gadget is available.

The safest pattern is to avoid using pickle for any data that originates outside a strictly controlled trust boundary and not rely solely on scanners for safety. Where deserialization is unavoidable, design the system so that only benign, data-only types are permitted and run deserialization in a constrained, least-privilege environment.

Establish development and security guidelines that treat general-purpose deserialization as dangerous by default, mandate safer serialization formats for cross-boundary data exchange, and require code review and automated checks for any new use of pickle or similar mechanisms. Regularly test and validate security tools against evolving gadget chains rather than assuming complete coverage.

Find out what's already
exploitable in your codebase.