Summary
A code injection weakness in picklescan before version 0.0.29 fails to recognize malicious idlelib.calltip.Calltip.fetch_tip usage inside Python pickle payloads.
If an application relies on vulnerable picklescan to vet untrusted pickle files, attackers can smuggle payloads that execute arbitrary code when processed with pickle.load().
Affected context
This vulnerability appears in environments that:
- Use Python pickle serialization to load data structures
- Depend on picklescan (pre-0.0.29) to detect dangerous constructs in pickle files
- Accept or process pickle data from sources that are not fully trusted
Under these conditions, malicious pickle content can bypass scanning and execute at load time.
Exploit preconditions
- Attack surface: Any component that runs pickle.load() on data assumed safe after picklescan analysis
- Required access: Ability to supply or influence pickle files consumed by the application (e.g., uploaded files, API inputs, shared storage)
- Trigger point: Invocation of pickle.load() (or equivalent) on a crafted pickle containing idlelib.calltip.Calltip.fetch_tip or similar constructs
- Why exploitation is possible: The scanner's rules do not flag this callable chain as dangerous, allowing attacker-controlled code paths to be invoked during object reconstruction
Why this happens
The core issue is incomplete detection logic within the picklescan tool that underestimates the attack surface of Python's pickle protocol.
Specifically, picklescan before 0.0.29 does not treat idlelib.calltip.Calltip.fetch_tip and related behaviors as dangerous, enabling adversaries to embed executable flows within serialized objects that appear benign to the scanner.
This aligns with CWE-95: Improper Neutralization of Directives in Dynamically Evaluated Code (Code Injection) because attacker-controlled data steers execution when the pickle is deserialized.
Potential impact
- Remote execution of arbitrary Python code under the permissions of the deserializing process
- Full compromise of the affected application or service
- Unauthorized access to sensitive data loaded in the same runtime
- Further lateral movement or deployment of additional malicious components
General mitigation guidance
Effective mitigation strategies focus on reducing trust in pickle-based data and strengthening inspection practices:
- Avoid using pickle for untrusted or semi-trusted data; prefer safer, schema-driven formats such as JSON or protocol buffers
- Treat all pickle input as potentially dangerous, even if scanned, and minimize or remove the need for dynamic object reconstruction from external sources
- Introduce strict allowlists for classes and callables that can be instantiated during deserialization, rejecting anything outside the approved set
- Run deserialization in constrained environments with least privilege and strong isolation so that any unexpected execution is contained
- Incorporate defense-in-depth checks, such as content validation and runtime guards, rather than relying solely on a scanning tool
How teams detect issues like this
Organizations can detect this class of risk through:
- Static analysis rules that flag uses of pickle.load(), loads(), or similar APIs on data from external sources
- Code review practices that question any dependence on pickle for inbound data and the assumption that scanners make it safe
- Security policies that discourage dynamic code evaluation or deserialization of complex objects originating outside the trust boundary
- Runtime monitoring to detect anomalous behavior patterns during pickle processing, such as unexpected imports, file access, or network calls
- Periodic assessment of third-party security tools (like picklescan) to ensure their coverage matches current exploitation techniques

