CVE-2025-71344: picklescan RCE via Undetected ensurepip._run_pip
picklescan is a security scanning tool designed to detect malicious code hidden in pickle files before they're loaded by Python applications. However, versions 0.0.26 and earlier have a critical blind spot: they fail to recognize the ensurepip._run_pip function when embedded in pickle files. Attackers can exploit this gap by crafting malicious pickle files that call ensurepip._run_pip through __reduce__ methods—a standard pickle deserialization hook. When an application using vulnerable picklescan loads such a file, the malicious code executes without triggering any security alert, giving attackers arbitrary code execution on the system.
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-06-22 / 2026-06-23
NVD description (verbatim)
picklescan before 0.0.30 (affected versions 0.0.26 and earlier) fails to detect the ensurepip._run_pip built-in function when scanning pickle files, allowing attackers to execute arbitrary code. Malicious pickle files embedding ensurepip._run_pip calls in __reduce__ methods bypass picklescan detection and achieve remote code execution upon pickle.load() invocation.
3 reference(s) · View on NVD →
SEC.co analysis · AI-assisted, reviewed against source
Technical summary
The vulnerability stems from incomplete built-in function detection in picklescan's opcode analysis. Specifically, ensurepip._run_pip, a legitimate but dangerous Python standard library function, is not blacklisted or flagged during pickle scanning. Malicious actors can embed calls to this function within pickle object __reduce__ methods, leveraging pickle's protocol to automatically invoke arbitrary callables during deserialization. Because picklescan does not detect this particular function signature, files containing ensurepip._run_pip calls pass validation and execute unrestricted when pickle.load() is invoked. This bypasses the entire purpose of the scanning tool and creates a false sense of security for downstream applications.
Business impact
For organizations relying on picklescan to validate untrusted pickle data, this vulnerability undermines core security assumptions. Development and DevOps teams may be unaware that their pickle scanning is incomplete, leading to deployment of applications that appear protected but are actually exposed to remote code execution. If untrusted pickle files are processed—such as from user uploads, API payloads, or cached data sources—attackers can achieve full code execution with the privileges of the application process. Incident response costs, data exfiltration risk, and supply chain contamination become serious concerns for affected systems.
Affected systems
Any Python application using picklescan version 0.0.26 or earlier to validate pickle files is vulnerable. This includes systems that load pickles from external sources (web uploads, API calls, databases, or inter-service communication). The vulnerability is particularly acute in microservices architectures, machine learning pipelines, and data serialization workflows where pickle deserialization is common. Organizations running picklescan in CI/CD pipelines to validate model or data artifacts are also at risk if they have not yet upgraded to version 0.0.30 or later.
Exploitability
Exploitation requires an attacker to craft a malicious pickle file containing an ensurepip._run_pip call and deliver it to a target application that uses vulnerable picklescan. The attack requires user interaction only to the extent that the application must attempt to load and validate the pickle file—a common operation in many automated systems. The CVSS vector (AV:N/AC:L/PR:N/UI:R) reflects that the attack is network-accessible with low complexity and requires only that a user or automated system interact with the malicious file. No authentication or special privileges are needed to trigger the vulnerability. Given the ubiquity of pickle usage in Python applications, the attack surface is substantial.
Remediation
Upgrade picklescan to version 0.0.30 or later, which addresses the detection gap by properly identifying ensurepip._run_pip and other similar built-in functions. Organizations should audit their current picklescan deployment versions across development, testing, and production environments. Additionally, implement defense-in-depth measures: avoid loading pickles from untrusted sources where possible, enforce strict network segmentation for services that do, run pickle-loading processes with minimal privileges, and consider using safer serialization formats (e.g., JSON) when pickle is not strictly necessary.
Patch guidance
Update picklescan to version 0.0.30 or later. Verify the upgrade by checking the installed version with pip show picklescan or inspecting your environment's dependency lock file. If using picklescan as a CI/CD scanning tool, update the tool version in your pipeline configuration and re-validate previously scanned artifacts with the new version to ensure no malicious files were missed. Test the upgraded version in a staging environment to confirm compatibility with your pickle validation workflows before rolling out to production systems.
Detection guidance
Search your codebase and container images for picklescan imports or installations to identify affected services. Use pip freeze, requirements.txt, poetry.lock, or equivalent dependency manifests to determine current versions. Monitor logs from pickle-loading applications for unusual process spawning or network connections that might indicate exploitation. Network-based detection is challenging without deep packet inspection, but behavioral anomalies (unexpected subprocess creation, pip package downloads) following pickle deserialization should trigger investigation. Consider adding explicit logging around pickle.load() calls to track which files are being deserialized and from which sources.
Why prioritize this
This vulnerability merits immediate attention because it directly undermines a security control (picklescan) that organizations may rely on to mitigate pickle deserialization risks. The HIGH CVSS score (8.1) reflects the combination of network accessibility, high impact on confidentiality and integrity, and low attack complexity. Unlike vulnerabilities in rarely-used libraries, picklescan is a dedicated security tool, so its failure has concentrated impact on systems that explicitly trust it. The fact that it is not yet in CISA's KEV catalog does not diminish urgency—patching should be treated as critical.
Risk score, explained
The CVSS 3.1 score of 8.1 (HIGH) accounts for: network-accessible attack vector (AV:N), low attack complexity (AC:L), no privilege requirements (PR:N), limited user interaction (UI:R), high impact on confidentiality (C:H) and integrity (I:H), and no impact on availability (A:N). The score appropriately captures the severity of unauthenticated remote code execution. The UI:R component reflects that an application or user must load the pickle file, which is a weak constraint in automated environments but a realistic one. The absence of availability impact reflects that RCE typically allows an attacker to maintain access rather than disrupt service.
Frequently asked questions
Can picklescan still be used after upgrading to 0.0.30?
Yes. Picklescan continues to serve its security purpose after upgrade. Version 0.0.30 simply closes the detection gap that allowed ensurepip._run_pip to bypass checks. The tool remains useful for scanning pickle files, but recognize that no scanner is 100% complete—defense in depth is essential.
Do all pickle files need to be re-scanned after upgrading picklescan?
It depends on your threat model. If you store pickle files long-term, re-scanning previously validated files with the upgraded version can help detect any malicious files that slipped through older versions. However, picklescan's primary value is in scanning incoming or untrusted pickles, so focus on continuous validation of new files first.
Is pickle still safe to use in production applications?
Pickle deserialization of untrusted data is inherently risky and should be avoided. If you must use pickle, run the deserialization process with minimal privileges, in isolated environments (containers, VMs), and after thorough validation with current security tools. Consider safer alternatives like JSON, Protocol Buffers, or MessagePack for most use cases.
Why wasn't ensurepip._run_pip already on picklescan's detection list?
Picklescan maintains a blocklist of dangerous built-in functions, but no finite list can be exhaustive. Ensurepip._run_pip is a standard library function not typically intended for malicious use, so it likely was not initially prioritized for detection. This highlights why layered security controls are essential rather than relying on any single scanner.
This analysis is based on the vulnerability description and CVSS scoring provided. Verify all patch versions, affected product ranges, and remediation steps against official vendor advisories before implementing. SEC.co makes no warranty as to the completeness or accuracy of this information. Always test patches in non-production environments before deployment. Organizations should adapt guidance to their specific infrastructure, threat model, and compliance requirements. This explainer is for informational purposes and does not constitute legal or professional security advice. Source: NVD (public-domain), retrieved 2026-07-28. 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-71341HIGHPicklescan Bypass Enables Remote Code Execution via profile.Profile.runctx
- CVE-2025-71348HIGHpicklescan Detection Evasion in Torch Config Loading
- CVE-2025-71357HIGHPicklescan Evasion via idlelib.pyshell.ModifiedInterpreter
- CVE-2025-71358HIGHpicklescan Detection Bypass via Malicious Pickle Files (CVSS 8.1)