9.3critical
PyTorch: `torch.load` with `weights_only=True` leads to remote code execution
- Severity
- 9.3critical CVSS:4.0 by GitHub_M
- Exploit likelihood
- 2.37% (higher than 84% of CVEs; EPSS, by FIRST)
- Published
- Last changed
- Assigned by
- GitHub_M
- Also known as
- GHSA-53q9-r3pm-6pq6BIT-PYTORCH-2025-32434PYSEC-2025-41
Description
PyTorch is a Python package that provides tensor computation with strong GPU acceleration and deep neural networks built on a tape-based autograd system. In version 2.5.1 and prior, a Remote Command Execution (RCE) vulnerability exists in PyTorch when loading a model using torch.load with weights_only=True. This issue has been patched in version 2.6.0.
Affected
| Product or package | Versions | Reported by |
|---|---|---|
| pytorch pytorch | < 2.6.0 | CVE List |
| torch (PyPI) | before 2.6.0 | GitHub Advisory Database, PyPA Advisory Database |
| linuxfoundation pytorch | before 2.6.0 | NVD |
| pytorch (Bitnami) | before 2.6.0 | Bitnami Vulnerability Database |
All scores
| GitHub_M | 9.3critical CVSS:4.0 | CVSS:4.0/AV:N/AC:L/AT:N/PR:N/UI:N/VC:H/VI:H/VA:H/SC:N/SI:N/SA:N |
| GitHub | critical CVSS:4.0 | CVSS:4.0/AV:N/AC:L/AT:N/PR:N/UI:N/VC:H/VI:H/VA:H/SC:N/SI:N/SA:N |
| NVD | 9.8critical CVSS:3.1 | CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:H/A:H |
| PyPA Advisory Database | 9.8critical CVSS:3.1 | CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:H/A:H |
| Bitnami Vulnerability Database | critical rating |
Classification
SSVC (CISA-ADP): exploitation none, automatable yes, technical impact total.
What each source says
CVE List
PyTorch is a Python package that provides tensor computation with strong GPU acceleration and deep neural networks built on a tape-based autograd system. In version 2.5.1 and prior, a Remote Command Execution (RCE) vulnerability exists in PyTorch when loading a model using torch.load with weights_only=True. This issue has been patched in version 2.6.0.
GitHub Advisory Database
Description
I found a Remote Command Execution (RCE) vulnerability in PyTorch. When loading model using torch.load with weights_only=True, it can still achieve RCE.
Background knowledge
https://github.com/pytorch/pytorch/security
As you can see, the PyTorch official documentation considers using torch.load() with weights_only=True to be safe.
image
Since everyone knows that weights_only=False is unsafe, so they will use the weights_only=True to mitigate the seucirty issue.
But now, I just proved that even if you use weights_only=True, it can still achieve RCE.
Credit
This vulnerability was found by Ji'an Zhou.
NVD (es)
PyTorch es un paquete de Python que proporciona computación tensorial con una potente aceleración de GPU y redes neuronales profundas basadas en un sistema de autogradación basado en cinta. En la versión 2.5.1 y anteriores, existía una vulnerabilidad de ejecución remota de comandos (RCE) en PyTorch al cargar un modelo usando torch.load con weights_only=True. Este problema se ha corregido en la versión 2.6.0.
References
Sources
| Source | Record | Licence |
|---|---|---|
| CVE List | CVE-2025-32434 changed 2025-12-01 | CVE Terms of Use |
| GitHub Advisory Database | GHSA-53q9-r3pm-6pq6 changed 2026-08-07 | CC-BY-4.0 |
| NVD | CVE-2025-32434 changed 2026-06-17 | Public domain |
| PyPA Advisory Database | PYSEC-2025-41 changed 2025-05-28 | CC-BY-4.0 |
| Bitnami Vulnerability Database | BIT-PYTORCH-2025-32434 changed 2026-09-08 | Apache-2.0 |