PyTorch Remote Command Execution Vulnerability in Model Loading

Vulnerability

A remote command execution vulnerability has been identified in PyTorch versions through 2.5.1. The issue arises when loading a model with the 'torch.load' function using the 'weights_only=True' option. Despite the official documentation suggesting this method is safe, it has been demonstrated that it can still lead to remote command execution. This vulnerability has been patched in PyTorch version 2.6.0.

Impact

Exploitation of this vulnerability allows for remote command execution on the system where PyTorch is running.

Reproduction

To reproduce this vulnerability, load a model using the 'torch.load' function with the 'weights_only' parameter set to 'True' in PyTorch versions through 2.5.1. This will trigger the remote command execution vulnerability, despite the 'weights_only=True' option being intended as a safeguard.

Remediation

Users can upgrade to PyTorch version 2.6.0 or later, where this vulnerability has been patched.

Added: Jun 9, 2025, 7:46 PM
Updated: Jun 9, 2025, 7:46 PM

Vulnerability Rating

Custom Algorithm
spread
6.6
impact
10.0
exploitability
6.0
remediation
7.7
relevance
0.0
threat
6.4
urgency
2.9
incentive
1.7

Our algorithm analyzes dozens of metrics to generate these 8 key vulnerability categories, which are then combined to calculate the overall risk score.