Summary
A flaw in picklescan before version 0.0.29 allows malicious pickle payloads that leverage idlelib.calltip.get_entity in reduce methods to evade detection.
Attackers can hide code in crafted pickle files that will execute remote commands when loaded by victim applications that rely on picklescan for security screening.
Affected context
This vulnerability appears in environments that use picklescan as a security check for Python pickle files, particularly before version 0.0.29.
It is relevant where user-supplied or third-party pickle data is accepted and scanned, and application code assumes that picklescan will reliably flag dangerous deserialization behavior before unpickling occurs.
The risk is elevated in automated workflows, services, or tools that deserialize pickles from semi-trusted sources under the belief that picklescan has filtered malicious content.
Exploit preconditions
- Attack surface: Any application or service that loads pickle files after scanning them with a vulnerable picklescan version.
- Required access: Ability to supply or influence pickle data consumed by the victim (e.g., file upload, API input, shared artifact).
- Trigger point: Deserialization of a crafted pickle object whose
reducemethod usesidlelib.calltip.get_entity, bypassing picklescan's detection logic. - Why exploitation is possible: The detection engine fails to recognize this specific code execution vector, allowing malicious constructors embedded in the pickle stream to remain unflagged and execute at unpickling time.
Why this happens
The underlying issue stems from incomplete coverage of execution primitives in the pickle detection logic, a classic unsafe deserialization pattern mapped to CWE-502.
picklescan's analysis fails to treat the idlelib.calltip.get_entity function in reduce methods as a dangerous call chain capable of invoking arbitrary code during unpickling.
As a result, attacker-controlled pickle data can reference this function to execute commands, while the security scanner incorrectly treats the payload as benign.
Potential impact
- Remote execution of attacker-controlled commands on systems that deserialize the malicious pickle.
- Compromise of application processes, including installation of backdoors or malware.
- Unauthorized access to sensitive data handled by the deserializing application.
- Lateral movement within the environment using the compromised application as a foothold.
- Tampering with models, configuration objects, or other serialized artifacts used in production workflows.
General mitigation guidance
Effective mitigation centers on reducing trust in pickle data and tightening deserialization behavior.
Pattern-based defenses include:
- Treating all pickle input as untrusted and avoiding deserialization in security-sensitive contexts where possible.
- Applying strict allowlists for callable targets and modules that may be invoked via
reduceor other pickle mechanisms. - Introducing sandboxing or process isolation for any required deserialization, limiting available commands and filesystem access.
- Favoring safer serialization formats (e.g., JSON, msgpack, or protocol buffers) for data exchange between components.
- Applying least privilege to processes that handle untrusted serialized data, minimizing the blast radius of a successful exploit.
How teams detect issues like this
Detection efforts can focus on both code and runtime behavior:
- Static analysis rules that flag use of
pickle,cPickle, or similar modules for untrusted data, especially with complexreduceimplementations. - Code review practices that look for assumptions about the safety of scanners like picklescan and verify that deserialization is treated as high risk.
- Runtime monitoring for unexpected subprocess creation, outbound network connections, or file modifications originating from deserialization routines.
- Policy enforcement that restricts the use of dangerous modules or introspection functions such as those in
idlelibin serialization logic. - Automated security testing that feeds crafted pickles into deserialization paths to confirm that scanners and guards properly detect or block them.

