Summary
picklescan before 0.0.33 fails to detect malicious pickle payloads that abuse the numpy.f2py.crackfortran.param_eval function inside reduce methods.
Remote attackers can embed undetected code in crafted pickle files that executes during deserialization, enabling arbitrary code execution when applications load untrusted pickle data.
Affected context
This vulnerability appears in environments that rely on picklescan to vet Python pickle files before deserialization, particularly when loading data from untrusted or semi-trusted sources.
It is most relevant where:
- Python pickle is used for data interchange or storage
- picklescan is assumed to provide comprehensive security checks
- Applications deserialize pickles that may be influenced by remote users, external systems, or shared storage.
Exploit preconditions
- Attack surface: Any service or application that loads pickle data and uses picklescan for pre-deserialization security validation.
- Required access: Ability to supply or modify pickle files consumed by the target application (e.g., file uploads, API inputs, shared data stores).
- Trigger point: Deserialization of a crafted pickle which passes picklescan's checks but contains a payload using numpy.f2py.crackfortran.param_eval within reduce methods.
- Why exploitation is possible: picklescan's detection logic does not cover this specific function and pattern, allowing malicious object graphs to be treated as safe and executed during unpickling.
Why this happens
The underlying issue is incomplete coverage of dangerous callable paths in picklescan's inspection logic for Python pickle payloads.
In CWE-502 terms, the tool fails to reliably identify unsafe deserialization constructs, allowing attackers to embed executable behavior via numpy.f2py.crackfortran.param_eval in reduce methods.
Because pickle deserialization inherently allows object and code reconstruction, missing detection of such patterns means untrusted input is effectively treated as trusted, executable state.
Potential impact
- Remote attackers may execute arbitrary Python code within the deserializing application's process.
- Attackers could read or modify application data and configuration.
- Compromise of application integrity, leading to data tampering or logic alteration.
- Potential lateral movement within the environment if the compromised process has broader access.
General mitigation guidance
Effective mitigation focuses on reducing reliance on pickle for untrusted data and strengthening validation boundaries around deserialization.
Recommended defensive patterns include:
- Avoid using Python pickle for data originating from untrusted or external sources; prefer formats like JSON or other non-executable encodings.
- Treat any deserialization mechanism as a high-risk boundary and restrict what types and callables can be reconstructed.
- Layer security checks so a single detection tool is not the only control; combine static checks, runtime guards, and strict input validation.
- Run deserialization in constrained environments (least privilege, reduced filesystem and network access) to limit impact if code execution occurs.
- Explicitly enumerate allowed classes or structures and block anything outside a tightly controlled whitelist.
How teams detect issues like this
High-level detection strategies for this class of issue include:
- Static analysis rules that flag use of pickle (or similar mechanisms like marshal, shelve) with untrusted input, especially where security scanning tools are assumed to be complete.
- Code review practices that treat any deserialization of user-controlled data as a critical security hotspot requiring architectural justification.
- Policy enforcement that discourages unsafe serialization formats and requires safer alternatives for external interfaces.
- Use of automated security tools that understand Python's serialization APIs and can highlight dangerous usage patterns, combined with tests that simulate malicious pickle payloads to validate defenses.

