CVE-2025-1945: picklescan: ZIP flag bypass enables RCE in PyTorch models
GHSA-w8jq-xcqf-f792 CRITICAL PoC AVAILABLE CISA: TRACK*picklescan is a widely-deployed security gate for PyTorch model files — this vulnerability completely nullifies that control. An attacker can distribute malicious .pt/.pth files that pass picklescan inspection while executing arbitrary code on load via torch.load(). Update picklescan to 0.0.23 immediately and re-scan all previously cleared model files; any CI/CD or model registry pipeline that relied on picklescan < 0.0.23 should be treated as potentially compromised.
Risk Assessment
Critical risk for ML teams using picklescan as their primary or sole defense against unsafe model deserialization. The bypass is deterministic — flipping specific ZIP header bits is a reproducible technique requiring no special privileges or network access. EPSS is currently low (0.31%), suggesting no mass exploitation yet, but the patch and advisory are public, compressing the weaponization window. Organizations with public-facing model registries or shared model stores face the highest exposure. Defense-in-depth gaps are the core issue: most ML pipelines trust picklescan as a single control point rather than layering it with sandbox loading or format enforcement.
Affected Systems
| Package | Ecosystem | Vulnerable Range | Patched |
|---|---|---|---|
| picklescan | pip | — | No patch |
| picklescan | pip | < 0.0.23 | 0.0.23 |
Severity & Risk
Attack Surface
Recommended Action
7 steps-
PATCH
Update picklescan to >= 0.0.23 on all systems immediately (pip install --upgrade picklescan).
-
RE-SCAN: Re-run updated picklescan against all model files previously scanned and cleared by older versions.
-
FORMAT ENFORCEMENT
Migrate to safetensors format (huggingface/safetensors) wherever possible — eliminates pickle deserialization risk entirely.
-
TORCH LOAD HARDENING
Enforce weights_only=True in all torch.load() calls (PyTorch >= 2.0) as a defense-in-depth measure; this disables arbitrary code execution during deserialization.
-
SANDBOX LOADING
Load untrusted models in isolated containers/VMs with no network access and minimal privileges before promoting to production.
-
DETECTION
Alert on picklescan version < 0.0.23 in your package inventories via SCA tooling (Dependabot, Snyk, Renovate).
-
SUPPLY CHAIN
Audit upstream model sources — any model pulled from public repositories (HuggingFace Hub, Kaggle, GitHub) since this technique became known should be re-validated.
CISA SSVC Assessment
Source: CISA Vulnrichment (SSVC v2.0). Decision based on the CISA Coordinator decision tree.
Classification
Compliance Impact
This CVE is relevant to:
Frequently Asked Questions
What is CVE-2025-1945?
picklescan is a widely-deployed security gate for PyTorch model files — this vulnerability completely nullifies that control. An attacker can distribute malicious .pt/.pth files that pass picklescan inspection while executing arbitrary code on load via torch.load(). Update picklescan to 0.0.23 immediately and re-scan all previously cleared model files; any CI/CD or model registry pipeline that relied on picklescan < 0.0.23 should be treated as potentially compromised.
Is CVE-2025-1945 actively exploited?
Proof-of-concept exploit code is publicly available for CVE-2025-1945, increasing the risk of exploitation.
How to fix CVE-2025-1945?
1. PATCH: Update picklescan to >= 0.0.23 on all systems immediately (pip install --upgrade picklescan). 2. RE-SCAN: Re-run updated picklescan against all model files previously scanned and cleared by older versions. 3. FORMAT ENFORCEMENT: Migrate to safetensors format (huggingface/safetensors) wherever possible — eliminates pickle deserialization risk entirely. 4. TORCH LOAD HARDENING: Enforce weights_only=True in all torch.load() calls (PyTorch >= 2.0) as a defense-in-depth measure; this disables arbitrary code execution during deserialization. 5. SANDBOX LOADING: Load untrusted models in isolated containers/VMs with no network access and minimal privileges before promoting to production. 6. DETECTION: Alert on picklescan version < 0.0.23 in your package inventories via SCA tooling (Dependabot, Snyk, Renovate). 7. SUPPLY CHAIN: Audit upstream model sources — any model pulled from public repositories (HuggingFace Hub, Kaggle, GitHub) since this technique became known should be re-validated.
What systems are affected by CVE-2025-1945?
This vulnerability affects the following AI/ML architecture patterns: model registries, training pipelines, model serving, MLOps/CI-CD pipelines, model hub integrations.
What is the CVSS score for CVE-2025-1945?
CVE-2025-1945 has a CVSS v3.1 base score of 9.8 (CRITICAL). The EPSS exploitation probability is 0.87%.
Technical Details
NVD Description
picklescan before 0.0.23 fails to detect malicious pickle files inside PyTorch model archives when certain ZIP file flag bits are modified. By flipping specific bits in the ZIP file headers, an attacker can embed malicious pickle files that remain undetected by PickleScan while still being successfully loaded by PyTorch's torch.load(). This can lead to arbitrary code execution when loading a compromised model.
Exploitation Scenario
An adversary targets an organization's internal model registry that uses picklescan as a pre-upload security gate. They craft a malicious PyTorch model file containing a pickle payload that establishes a reverse shell. By flipping specific general-purpose bit flags in the ZIP local file headers of the .pt archive, the file passes picklescan's detection logic while remaining fully parseable by Python's zipfile module and PyTorch's torch.load(). The attacker uploads the trojanized model to a public HuggingFace repository or injects it into the organization's model supply chain (e.g., via a compromised third-party model vendor). A data scientist or MLOps pipeline calls torch.load() on the model — picklescan raises no alert — and the payload executes with the privileges of the loading process, granting the attacker initial access to the ML infrastructure.
Weaknesses (CWE)
CVSS Vector
CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:H/A:H References
- github.com/mmaitre314/picklescan/commit/e58e45e0d9e091159c1554f9b04828bbb40b9781 Patch
- github.com/mmaitre314/picklescan/security/advisories/GHSA-w8jq-xcqf-f792 Exploit Vendor
- sonatype.com/security-advisories/cve-2025-1945
- github.com/advisories/GHSA-w8jq-xcqf-f792
- github.com/pypa/advisory-database/tree/main/vulns/picklescan/PYSEC-2025-21.yaml
- nvd.nist.gov/vuln/detail/CVE-2025-1945
- sites.google.com/sonatype.com/vulnerabilities/cve-2025-1945
- github.com/fkie-cad/nvd-json-data-feeds Exploit
Timeline
Related Vulnerabilities
GHSA-vvpj-8cmc-gx39 10.0 picklescan: security flaw enables exploitation
Same package: picklescan GHSA-7wx9-6375-f5wh 9.8 picklescan: Allowlist Bypass evades input filtering
Same package: picklescan GHSA-g38g-8gr9-h9xp 9.8 picklescan: Allowlist Bypass evades input filtering
Same package: picklescan GHSA-hgrh-qx5j-jfwx 8.8 picklescan: Protection Bypass circumvents security controls
Same package: picklescan CVE-2025-10157 8.3 PickleScan: subclass bypass enables malicious model RCE
Same package: picklescan
AI Threat Alert