AI and data stack advisories

Severe, 6 weeks1496Projects326

1496 severe, 6 weeks · 326 projects

PyTorchGHSA-53q9-r3pm-6pq6

PyTorch: `torch.load` with `weights_only=True` leads to remote code execution

PyTorch

CVE-2025-32434 · Published Apr 18, 2025 · updated Aug 7, 2026

Critical
Fix: upgrade to 2.6.0 or later
GitHub advisory

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](https://github.com/user-attachments/assets/fdaa8520-d66a-473a-ab1f-163d793de298)

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.

Affected versions

PackageAffectedFixed in
torch
PyPI
< 2.6.02.6.0
Details and references

More PyTorch advisories

All PyTorch