GHSA-53q9-r3pm-6pq6Critical

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

Published
April 18, 2025
Last Modified
August 29, 2025

🔗 CVE IDs covered (1)

📋 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. image 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.

🎯 Affected products1

  • pip/torch:< 2.6.0

🔗 References (5)