Skip to the content
AI and Cybersecurity Learning and Practice Center Test automation Open the Learning Center

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

Known CVEs

  • CVE-2025-32434 Critical PyTorch torch.load remote code execution, even with weights_only=True
    Apr 18, 2025 · fixed in 2.6.0

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

Compare it with the others on the Technology watch list