CVE-2025-71366: picklescan Gadget Chain Detection Bypass (Torch)
picklescan is a Python library designed to scan pickle files for malicious code before they're loaded. Version 0.0.27 and earlier have a critical blind spot: they fail to detect when attackers embed calls to torch.utils.bottleneck.__main__.run_cprofile inside pickle files. An attacker can craft a malicious pickle file that passes picklescan's safety checks, then execute arbitrary code when a victim loads the file. The vulnerability requires user interaction (a victim must load the file), but once they do, the attacker gains full code execution with the victim's privileges.
Source data · NVD / CISA · public domain
- CVSS
- 3.1 · 8.1 HIGH · CVSS:3.1/AV:N/AC:L/PR:N/UI:R/S:U/C:H/I:H/A:N
- Weaknesses (CWE)
- CWE-502
- Affected products
- 0 configuration(s)
- Published / Modified
- 2026-07-04 / 2026-07-06
NVD description (verbatim)
picklescan before 0.0.28 fails to detect malicious torch.utils.bottleneck.__main__.run_cprofile function calls in pickle files, allowing attackers to bypass safety checks. Remote attackers can embed undetected code in pickle files to achieve arbitrary code execution when victims load the files.
3 reference(s) · View on NVD →
SEC.co analysis · AI-assisted, reviewed against source
Technical summary
CVE-2025-71366 is an unsafe deserialization weakness (CWE-502) in picklescan's detection logic. The vulnerability stems from incomplete coverage of gadget chains—picklescan fails to identify torch.utils.bottleneck.__main__.run_cprofile as a dangerous callable. When a pickle file is deserialized by Python's pickle module, this function can be invoked without restriction, bypassing picklescan's intended safety perimeter. The attack vector is network-based; an attacker delivers a malicious pickle over any channel (email attachment, web download, API response) and relies on the victim to deserialize it using picklescan or Python's pickle module directly. No authentication is required from the attacker's perspective.
Business impact
Organizations using picklescan to safely handle untrusted pickle files face compromised trust in their validation layer. This is especially critical for teams processing machine learning models, data science workflows, or serialized Python objects from external sources. A successful exploit can lead to data theft, lateral movement within networks, deployment of backdoors, or supply-chain contamination if pickled objects are part of a distribution pipeline. The impact is heightened in automated environments where pickle deserialization happens without human review.
Affected systems
picklescan versions 0.0.27 and earlier are vulnerable. The library is used by Python developers and data science teams to pre-screen pickle files before loading them. Systems relying on picklescan as a primary defense mechanism against malicious serialized objects are at risk. torch (PyTorch) is not inherently vulnerable; it is the target gadget that picklescan's scanner failed to recognize. Any environment deserializing untrusted pickle data with picklescan versions before 0.0.28 is affected.
Exploitability
Exploitability is moderate to high. An attacker must craft a malicious pickle file—a non-trivial task requiring knowledge of Python serialization and the specific gadget chain—but tools and techniques for pickle exploitation are well-established in the security community. The attack requires user interaction (opening or loading the file), which is a constraint but not a significant barrier given social engineering tactics. Once delivered, exploitation is reliable: the pickle deserializes without warning, the gadget fires, and code runs. No special software versions or complex conditions are needed beyond picklescan 0.0.27 or earlier.
Remediation
Upgrade picklescan to version 0.0.28 or later immediately. This patch extends the scanner's detection rules to include the torch.utils.bottleneck.__main__.run_cprofile gadget chain and likely hardens detection of related callables. Organizations should verify the upgrade in a test environment before production rollout. As a complementary measure, restrict pickle deserialization to trusted sources only, isolate pickle processing in sandboxed environments, and consider using safer serialization formats (JSON, protobuf, msgpack) where feasible.
Patch guidance
Patch guidance: Upgrade picklescan to version 0.0.28 or later. Review your dependency management (pip, poetry, conda, etc.) to ensure the update is applied across all development, testing, and production environments. For teams using picklescan as a transitive dependency, verify that the parent package does not pin an older version. Test pickle files that previously passed validation to confirm they still load correctly with the patched version. If you maintain a corpus of pickle files for regression testing, run them against the patched scanner to ensure no legitimate workflows are broken.
Detection guidance
Detection and monitoring: Search your codebase and logs for imports of picklescan and verify all instances use version 0.0.28+. Monitor for deserialization of pickle files from untrusted sources; log file origins and validate against known-good hashes. If you cannot patch immediately, implement additional controls: disable automatic pickle loading, require manual approval for pickle operations, run pickle deserialization in isolated containers, or switch to safer formats. Intrusion detection signatures should flag unusual subprocess spawning or code execution following pickle loads from external sources.
Why prioritize this
This vulnerability merits urgent priority because picklescan is explicitly designed to prevent arbitrary code execution during pickle deserialization. Its failure to detect a known gadget chain directly undermines trust in a critical safety mechanism. The attack is remotely deliverable, requires only user interaction (not complex setup), and grants full code execution. Organizations using picklescan as part of a defense-in-depth strategy for untrusted serialized objects should patch within days, not weeks.
Risk score, explained
CVE-2025-71366 carries a CVSS 3.1 score of 8.1 (HIGH) reflecting: network-accessible attack vector, low complexity (standard pickle gadget), no special privileges required, user interaction (loading the file), and high impact on confidentiality and integrity. The score does not account for the specific context of picklescan's role as a safety validator; in practice, the risk may be higher for organizations relying solely on picklescan for defense against untrusted pickle sources.
Frequently asked questions
How do I know if my application uses picklescan?
Check your project's dependency file (requirements.txt, setup.py, pyproject.toml, Pipfile) for picklescan. Run `pip show picklescan` in your environment. Search your codebase for imports like `from picklescan.scanner import scan_file_object` or `import picklescan`. Additionally, check if picklescan is a transitive dependency of another package you use.
Can I safely load pickle files with picklescan 0.0.27 if I don't use PyTorch?
Not necessarily. While this specific CVE exploits a PyTorch gadget, picklescan 0.0.27's incomplete detection may miss other malicious callables. Upgrade to 0.0.28+ to benefit from broader coverage. Additionally, pickle deserialization is inherently risky; picklescan is a layer of defense, not a complete guarantee. Always combine it with process isolation, sandboxing, and restriction of pickle sources to trusted origins.
Does this vulnerability affect PyTorch itself?
No. PyTorch is not the source of the vulnerability. The torch.utils.bottleneck.__main__.run_cprofile function is a legitimate PyTorch utility; the issue is that picklescan failed to recognize its use in a pickle as dangerous. Updating PyTorch is not necessary to fix this issue—upgrading picklescan is the solution.
What should I do if I cannot patch picklescan immediately?
Implement compensating controls: avoid deserializing pickle files from untrusted sources, run pickle operations in isolated containers with restricted system access, switch to safer serialization formats (JSON, protobuf), and require manual inspection of pickle files before loading. Monitor for anomalous behavior after pickle deserialization and maintain segmentation between systems that process pickles and critical infrastructure.
This analysis is provided for informational purposes and reflects publicly available information as of the publication and modification dates listed. Security risk and exploitability assessments are based on technical characteristics; actual risk in your environment depends on your specific use of picklescan, exposure to untrusted pickle sources, and compensating controls. Always verify patch availability and compatibility with your systems before deploying updates. SEC.co does not provide legal, compliance, or operational advice; consult your security and engineering teams for context-specific guidance. Source: NVD (public-domain), retrieved 2026-08-12. Analysis generated by SEC.co (claude-haiku-4-5).
Weaknesses (CWE)
Related vulnerabilities
- CVE-2025-11993HIGHWooCommerce Infinite Scroll Plugin PHP Object Injection – HIGH Severity
- CVE-2025-27511HIGHGeoServer DB2 JNDI Injection Remote Code Execution
- CVE-2025-69130HIGHPHP Object Injection in Entrepreneur WordPress Booking Theme ≤3.1.3
- CVE-2025-71339HIGHPicklescan Gadget Bypass Allows Arbitrary Code Execution
- CVE-2025-71340HIGHPicklescan Evasion via idlelib.pyshell.ModifiedInterpreter
- CVE-2025-71341HIGHPicklescan Bypass Enables Remote Code Execution via profile.Profile.runctx
- CVE-2025-71342HIGHPicklescan Evasion Enables Remote Code Execution in PyTorch Models
- CVE-2025-71343HIGHpicklescan Detection Bypass Allows Remote Code Execution