Summary
A detection gap in picklescan allows malicious pickle files to embed the asyncio.unix_events._UnixSubprocessTransport._start function in reduce methods without being flagged.
When such pickles are loaded by an application that relies on picklescan for safety checks, attackers can execute arbitrary commands, turning otherwise trusted deserialization into a remote code execution risk.
Affected context
This vulnerability affects environments where Python pickle files are used for data exchange, caching, or serialization and are scanned with vulnerable versions of picklescan.
It is most relevant when applications treat pickles as safe after passing picklescan checks, especially in services that deserialize data from external or semi-trusted sources.
The risk exists whenever untrusted or user-controlled pickle payloads are accepted and loaded under the assumption that picklescan will reliably detect dangerous reduce functions.
Exploit preconditions
- Attack surface: Any component that deserializes pickle data and relies on picklescan for pre-load safety validation
- Required access: Ability to supply or influence pickle payloads (e.g., file uploads, API inputs, message queues)
- Trigger point: Application calls
pickle.load/pickle.loadsor equivalent on a malicious payload that previously passed picklescan checks - Why exploitation is possible: picklescan before 0.0.30 does not recognize
asyncio.unix_events._UnixSubprocessTransport._startas a dangerous callable in pickle reduce methods, allowing attacker-controlled code paths to run on deserialization
Why this happens
The core issue maps to CWE-502: Unsafe Deserialization, where untrusted serialized data influences program execution.
In this case, the bug is not in the pickle protocol itself but in the security tool's incomplete threat model: picklescan's detection logic omits the asyncio.unix_events._UnixSubprocessTransport._start function from its list of dangerous or executable constructs.
Because pickle reduce mechanisms can invoke arbitrary callables during reconstruction, any detection gap effectively becomes an execution primitive when applications treat "scanned" pickles as trusted.
Potential impact
- Attackers may execute arbitrary OS commands under the privileges of the deserializing process.
- Compromised services could expose sensitive data or credentials.
- An attacker could pivot from the affected application to other internal systems.
- Remote compromise of application integrity and availability, including deployment-wide impact if shared deserialization services are used.
General mitigation guidance
Mitigation typically centers on reducing trust in pickle-based data and limiting what deserialization can do:
- Avoid using pickle for untrusted or external data when possible, favoring safer serialization formats (e.g., JSON) that do not execute code.
- Treat safety scanners like picklescan as an additional layer, not a primary trust guarantee; maintain strict input validation and compartmentalize deserialization.
- Constrain deserialization contexts using least-privilege execution, restricting filesystem, network, and process-spawning capabilities of components that handle pickles.
- Implement allow-list–based deserialization patterns where only specific, benign classes and callables are reconstructable from serialized data.
How teams detect issues like this
High-level detection strategies focus on both code and behavior:
- Static analysis rules can target usages of
pickle.load/pickle.loadsand identify paths where inputs may be influenced by external actors. - Code reviews should flag reliance on pickle scanning tools as a sole defense, and look for undocumented assumptions about "safe" serialized data.
- Security policies can mandate non-executable serialization formats for cross-boundary data exchanges and restrict pickle usage to internal, tightly controlled contexts.
- Runtime monitoring and alerting around unusual subprocess creation or command execution originating from deserialization routines can help uncover exploitation attempts.

