PyTorch: `torch.load` with `weights_only=True` leads to remote code execution
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.
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.
Betroffene Software
Klicken Sie auf eine Technologie, um alle zugehörigen Schwachstellen anzuzeigen.
| Plattform | Paket | Anfällige Versionen | Behoben in |
|---|---|---|---|
| Python (PyPI) | torch | < 2.6.0 | 2.6.0 |
Verweise
- https://github.com/pytorch/pytorch/security/advisories/GHSA-53q9-r3pm-6pq6
- https://nvd.nist.gov/vuln/detail/CVE-2025-32434
- https://github.com/pytorch/pytorch/commit/8d4b8a920a2172523deb95bf20e8e52d50649c04
- https://github.com/pypa/advisory-database/tree/main/vulns/torch/PYSEC-2025-41.yaml
- https://github.com/pytorch/pytorch
- CVSS-Vektor
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- Schwäche (CWE)
CWE-502- Plattform
- Python (PyPI)
- Paket
torch- Veröffentlicht
- 18.04.2025
- Aktualisiert
- 11.10.2026 14:19
Quellen und Lizenzen
OSV / GitHub Advisory Database - PYSEC-2025-41 - PyPA Advisory Database; CC BY 4.0
OSV / GitHub Advisory Database - GHSA-53q9-r3pm-6pq6 - CC BY 4.0
Schwachstellenhistorie: torch
Alle veröffentlichten Schwachstellen dieses Pakets (Python (PyPI)), neueste zuerst. Zeigt, ob es ein einmaliger Ausrutscher ist oder ein Paket, das man im Auge behalten muss.
- Einträge insgesamt
- 31
- Erste → letzte
- 11.2022 03.2026
- Ohne Fix
- 9
- In Angriffen ausgenutzt
- 0
Verteilung nach Schweregrad
- Kritisch 3
- Hoch 10
- Mittel 11
- Niedrig 5
- Nicht bewertet 2
Veröffentlichungen pro Jahr
- 2022: 1
- 2023: 0
- 2024: 4
- 2025: 24
- 2026: 2
-
PyTorch: `torch.load` with `weights_only=True` leads to remote code execution dieser Eintrag
Erkennen Sie Schwachstellen in Ihrer Anwendung
Mit der DockRay-Integration und aktivierter Softwareinventarisierung prüft DockRay gemeldete Komponentenversionen auf bekannte Schwachstellen und benachrichtigt Sie über bestätigte Treffer. Die Abdeckung hängt von der unterstützten Technologie und den verfügbaren Meldungen ab.