CVE-2025-32434 PyTorch: `torch.load` with `weights_only=True` leads to remote code execution
Attackers can achieve remote code execution by tricking users into loading malicious models with weights_only enabled in PyTorch.
- Exploited in the wild
- Not known
- Login needed
- Not needed
- Attackable
- Over the internet
- Victim action needed
- Not needed
- Fix
- Available
What is CVE-2025-32434?
CVE-2025-32434 is a critical unsafe deserialization vulnerability in pytorch, published on 18 Apr 2025. An attacker can exploit it over the internet without logging in, with no action from the victim.
Official 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.
Weakness: CWE-502
Which versions are affected by CVE-2025-32434?
4 open source packages ship an affected version, including pytorch and torch. It affects 1 product.
| Package | Affected | Fixed in |
|---|---|---|
pytorch Bitnami | All versions | 2.6.0 |
torch PyPI | All versions | 2.6.0 |
torch PyPI | All versions | 2.6.0 |
torch PyPI | All versions | 2.6.0 |
Products include Linuxfoundation Pytorch.
How do I fix CVE-2025-32434?
Upgrade pytorch to 2.6.0 or later.
Upgrade, and only deserialise data from trusted sources or with an allow-list of types. More about Unsafe deserialization.
Is CVE-2025-32434 being exploited?
There is no known exploitation of CVE-2025-32434 in the wild and no public exploit code.
Public exploit code: 4 proofs of concept on GitHub.
Other vulnerabilities in pytorch
Sources
Also known as AZL-60877, AZL-60880, BIT-pytorch-2025-32434, CLSA-2025-1760660047, DEBIAN-CVE-2025-32434, DLA-4389-1 and 2 more.