GitHub Advisoryadvisory · PyPI

GHSA-53q9-r3pm-6pq6 PyTorch: `torch.load` with `weights_only=True` leads to remote code execution

CRITICAL Published 2025-04-18 Modified 2025-08-29 Official page ↗
Aliases
CVE-2025-32434
Ecosystem
PyPI
Packages
torch
Severity
Critical
CVSS vector
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
Weaknesses
CWE-502
Reviewed
2025-04-18

Affected packages

• PyPI torch: < 2.6.0 → fixed in 2.6.0

Description

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.

Related

Alias · CVE (1)

  • CVE-2025-32434 PyTorch is a Python package that provides tensor computation with strong GPU acceleration and deep neural networks built on a tape-based… vulnerability

Weakness · CWE (1)

  • CWE-502 Deserialization of Untrusted Data weakness

References