Is my AI tool safe?Models and model filesPyTorch Foundation
Is PyTorch safe?
No tool is safe or unsafe on its own: it depends on what it can reach and how it is set up. The record for PyTorch: 2 incidents in this center's library and 1 CVE in its advisory feed (1 critical), the newest published Apr 18, 2025. Below: what went wrong, what was fixed, and how to use it safely.
What to watch for
torch.load runs whatever a pickle file tells it to, and the 2025 CVE showed that even weights_only=True could be bypassed. Every malicious-model incident in the library runs through this path.
How to use it safely
Use safetensors, keep torch at 2.6 or later, and never load a .pt or .pkl file from a source you have not verified.
What it can reach
- Loads model files that can execute code
What went wrong: incidents in the library
- nullifAI: broken pickle files slip malicious models past scanners High
Researchers found models on Hugging Face with hidden malware that the platform's scanner did not flag, because the files were deliberately corrupted right after the malicious code. - Hugging Face: malicious models that open a backdoor when loaded High
JFrog found about 100 models on Hugging Face containing real malicious code. Simply loading one in Python could give an outsider remote control of the data scientist's computer.
Known CVEs
- CVE-2025-32434 Critical PyTorch torch.load remote code execution, even with weights_only=True
How many people use it
- 4.8M PyPI downloads in a month (to Oct 1, 2026, without mirrors) · PyPI Stats
- 102k GitHub stars · GitHub
A high CVE count can mean heavy scrutiny as much as weak engineering, so read the incidents and advisories, not only the number. The counts are what this center has recorded, not every flaw ever found; usage figures are the vendors' and registries' own published numbers.
Sources
- PyPI Stats: PyPI downloads in a month (to Oct 1, 2026, without mirrors)
- GitHub: GitHub stars
- GitHub Advisory Database: torch
- ReversingLabs: malicious ML models on Hugging Face
- The Hacker News: broken pickle format evades detection
- JFrog: malicious Hugging Face models with a silent backdoor
- BleepingComputer: malicious AI models on Hugging Face