CVE-2024-31580 PyTorch heap buffer overflow vulnerability
Attackers can cause a Denial of Service in PyTorch via a heap buffer overflow triggered by crafted input.
- Exploited in the wild
- Not known
- Login needed
- Not needed
- Attackable
- Local or same network only
- Victim action needed
- Not needed
- Fix
- Available
What is CVE-2024-31580?
CVE-2024-31580 is a medium-severity memory corruption vulnerability in n/a, published on 17 Apr 2024. It can only be exploited from the same machine or local network, with no action from the victim.
Official description
PyTorch before v2.2.0 was discovered to contain a heap buffer overflow vulnerability in the component /runtime/vararg_functions.cpp. This vulnerability allows attackers to cause a Denial of Service (DoS) via a crafted input.
Weakness: CWE-122
Which versions are affected by CVE-2024-31580?
5 open source packages ship an affected version, including torch, pytorch and torch-npu. It affects 1 product.
| Package | Affected | Fixed in |
|---|---|---|
torch PyPI | All versions | 2.2.0 |
torch PyPI | All versions | 2.2.0 |
torch PyPI | All versions | 2.2.0 |
pytorch Bitnami | All versions | 2.2.1 |
torch-npu PyPI | All versions | 2.2.0 |
Products include Linuxfoundation Pytorch.
How do I fix CVE-2024-31580?
Upgrade torch to 2.2.0 or later.
Upgrade to the fixed version. Memory-safe languages, compiler hardening and fuzzing prevent most new cases. More about Memory corruption.
Is CVE-2024-31580 being exploited?
There is no known exploitation of CVE-2024-31580 in the wild and no public exploit code.
Other vulnerabilities in n/a
- CVE-2024-48063 Deserialization in n/a
- CVE-2022-45907 PyTorch vulnerable to arbitrary code execution
- CVE-2025-32434 PyTorch: `torch.load` with `weights_only=True` leads to remote code execution
- CVE-2026-24747 PyTorch Vulnerable to Remote Code Execution via Untrusted Checkpoint Files
- CVE-2024-31583 Pytorch use-after-free vulnerability
Sources
Also known as AZL-39930, BIT-pytorch-2024-31580, DEBIAN-CVE-2024-31580, GHSA-5pcm-hx3q-hm94, PYSEC-2024-252, PYSEC-2024-328 and 1 more.