PyTorch: `torch.load` with `weights_only=True` leads to remote code execution
CVE-2025-32434 · GHSA-53q9-r3pm-6pq6 · published 2025-04-18 · updated 2025-08-29
- Severity
- Critical
- CVSS score
- 9.3
- Chance of exploitation (EPSS)
- 2.4%
- Fixed in
- 2.6.0
- Exploitation No known exploitation
- Automatable Yes
- Technical impact Total
- CISA SSVC
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.
Upgrade torch to 2.6.0 or later.
| Package | Registry | Affected | Fixed in |
|---|---|---|---|
| torch | PyPI | < 2.6.0 | 2.6.0 |
- CriticalLMDeploy has Remote Code Execution by Pickle Deserialization via handle_zmq_recv in lmdeploy/lmdeploy/pytorch/disagg/conn/engine_conn.pylmdeploy
- CriticalLMdeploy has Remote Code Execution by Pickle Deserialization via zmq_rpc.call_and_response() in InterLM/lmdeploylmdeploy
- CriticalSGLang: Unauthenticated RCE via --enable-custom-logit-processorsglang
- CriticalSGLanG: Multimodal scheduler deserializes untrusted pickle data on 0.0.0.0 ROUTER socketsglang
- Criticaln8n: HTTP Request Node Pagination Prototype Pollution to RCEn8n, n8n, n8n
- Criticaln8n Has an XML Node Prototype Pollution Patch Bypassn8n, n8n, n8n
- CriticalPyTorch vulnerable to arbitrary code executiontorch
- HighPyTorch Vulnerable to Remote Code Execution via Untrusted Checkpoint Filestorch
- HighPyTorch heap buffer overflow vulnerabilitytorch
- HighPytorch use-after-free vulnerabilitytorch
- MediumPyTorch Improper Resource Shutdown or Release vulnerabilitytorch
- MediumPyTorch is Vulnerable to Memory Consumption through pad_packed_sequence Functiontorch
The impact, patch and workaround text comes from the advisory, shortened (GitHub Advisory Database, CC BY 4.0). Proof-of-concept and reproduction sections and code are left out; the original advisory has them.