CVE-2024-31583: Pytorch use-after-free vulnerability
Pytorch before version v2.2.0 was discovered to contain a use-after-free vulnerability in torch/csrc/jit/mobile/interpreter.cpp.
Published Apr 17, 2024 · Updated Jun 10, 2025
Affected packages
torch
- Ecosystem
- PyPI
- Affected
- < 2.2.0
- Fixed in
- 2.2.0
- Check
pip show torch
Advisory details
From the GitHub Advisory Database (CC BY 4.0).
Pytorch before version v2.2.0 was discovered to contain a use-after-free vulnerability in torch/csrc/jit/mobile/interpreter.cpp.
Credited to levpachmanov.
References
- https://nvd.nist.gov/vuln/detail/CVE-2024-31583
- https://github.com/pytorch/pytorch/commit/9c7071b0e324f9fb68ab881283d6b8d388a4bcd2
- https://gist.github.com/1047524396/43e19a41f2b36503a4a228c32cdbc176
- https://github.com/pytorch/pytorch/blob/v2.1.2/torch/csrc/jit/mobile/interpreter.cpp#L132
- https://security.snyk.io/vuln/SNYK-PYTHON-TORCH-6619806
- https://github.com/pypa/advisory-database/tree/main/vulns/torch/PYSEC-2024-251.yaml
- https://github.com/advisories/GHSA-pg7h-5qx3-wjr3
How this page is made: the data panel comes from the GitHub Advisory Database, CISA’s KEV catalog, the NVD and FIRST EPSS, and updates twice a day. No analysis has been written for this entry yet. Methodology
More PyPI vulnerabilities
All PyPI entriesCVE-2026-24747
PyTorch Vulnerable to Remote Code Execution via Untrusted Checkpoint Files
high8.8Jan 27, 2026CVE-2025-32434
PyTorch: `torch.load` with `weights_only=True` leads to remote code execution
critical9.3Apr 18, 2025CVE-2025-3730
PyTorch Improper Resource Shutdown or Release vulnerability
medium3.3Apr 16, 2025CVE-2025-2998
PyTorch is Vulnerable to Memory Consumption through pad_packed_sequence Function
medium5.3No fixMar 31, 2025CVE-2025-2999
PyTorch is vulnerable to memory corruption through its unpack_sequence function
medium5.3Mar 31, 2025CVE-2025-3000
PyTorch is vulnerable to memory corruption through its torch.jit.script function
low5.3Mar 31, 2025
