INCIDENT MAP

Browse / Unsafe Model Loading and Supply Chain / CVE-2025-32434

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

CVE-2025-32434 ยท 2025-04-18 critical

Class
Unsafe Model Loading and Supply Chain (filed by a model that read the advisory)
Technique
Code and command execution
Affected
torch (PyPI)
Gets past
Safe model loader or scanner
CVSS
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
EPSS
2.4% chance of exploitation in 30 days

How it works, in short

A crafted checkpoint abuses a deserialisation path that the weights-only loader still allows, so loading the file runs code. (Our summary, written by a model. The source text is below.)

Details

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.

References

Source: GitHub Advisory Database, used under CC BY 4.0.