CVE-2025-32434: PyTorch: `torch.load` with `weights_only=True` leads to remote code execution

Published Apr 18, 2025
·
Updated

Description I found a Remote Command Execution (RCE) vulnerability in PyTorch. When loading model using torch.load with weightsonly=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 weightsonly=True to be safe. !image Since everyone knows that weightsonly=False is unsafe, so they will use the weightsonly=True to mitigate the seucirty issue. But now, I just proved that even if you use weightsonly=True, it can still achieve RCE.

Credit This vulnerability was found by Ji'an Zhou.

Other sources

PyTorch is a Python package that provides tensor computation with strong GPU acceleration and deep neural networks built on a tape-based autograd system. In version 2.5.1 and prior, a Remote Command Execution (RCE) vulnerability exists in PyTorch when loading a model using torch.load with weightsonly=True. This issue has been patched in version 2.6.0.

NVD

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

Microsoft

Affected Software

7 affected componentsFixes available
pip/pytorch<=2.5.1
pip/torch<=2.5.1
2.6.0
linuxfoundation Pytorch Python<2.6.0
Microsoft azl3 pytorch 2.2.2-6<2.2.2-6
2.2.2-6
Microsoft cbl2 pytorch 2.0.0-9<2.0.0-8
2.0.0-8
Microsoft cbl2 pytorch 2.0.0-8<2.0.0-8
2.0.0-8
Microsoft azl3 pytorch 2.2.2-7<2.2.2-6
2.2.2-6

Remediation

Recommended actions to resolve this vulnerability, in priority order.

  1. Upgrade

    Upgrade pip/torch to a version that resolves this vulnerability.

    Fixed in 2.6.0
  2. Upgrade

    Upgrade to a fixed release to a version that resolves this vulnerability.

    Fixed in 2.2.2-6
  3. Upgrade

    Upgrade to a fixed release to a version that resolves this vulnerability.

    Fixed in 2.0.0-8
  4. Upgrade

    Upgrade pytorch to a version that resolves this vulnerability.

    Fixed in 2.6.0

Event History

Apr 18, 2025
Advisory Published
via GitHub·03:19 PM
CVE Published
via MITRE·03:48 PM
Data Sourced
via MITRE·03:48 PM
DescriptionWeakness
Data Sourced
via NVD·04:15 PM
DescriptionSeverityWeaknessAffected Software
Apr 24, 2025
Data Sourced
via Microsoft·07:00 AM
DescriptionSeverityWeakness
Data Sourced
via Microsoft·07:00 AM
Affected Software
Updated
via Microsoft·07:00 AM
DescriptionSeverity

Frequently Asked Questions

1

What is the severity of CVE-2025-32434?

CVE-2025-32434 is classified as a high-severity vulnerability due to its potential for Remote Command Execution.

2

How do I fix CVE-2025-32434?

To fix CVE-2025-32434, upgrade the PyTorch library to version 2.6.0 or later.

3

Which versions of PyTorch are affected by CVE-2025-32434?

CVE-2025-32434 affects all PyTorch versions up to and including 2.5.1.

4

What is the impact of CVE-2025-32434?

The impact of CVE-2025-32434 is that attackers can execute arbitrary commands on the server through the vulnerable model loading function.

5

Is CVE-2025-32434 related to any specific function in PyTorch?

Yes, CVE-2025-32434 is specifically related to the 'torch.load' function when used with 'weights_only=True'.

Contact

SecAlerts Pty Ltd.
132 Wickham Terrace
Fortitude Valley,
QLD 4006, Australia
info@secalerts.co
By using SecAlerts services, you agree to our services end-user license agreement. This website is safeguarded by reCAPTCHA and governed by the Google Privacy Policy and Terms of Service. All names, logos, and brands of products are owned by their respective owners, and any usage of these names, logos, and brands for identification purposes only does not imply endorsement. If you possess any content that requires removal, please get in touch with us.
© 2026 SecAlerts Pty Ltd.
ABN: 70 645 966 203, ACN: 645 966 203