CVE-2024-31580 PyTorch heap buffer overflow vulnerability

Medium 4.0 Published Updated

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.

PackageAffectedFixed in
torch PyPIAll versions2.2.0
torch PyPIAll versions2.2.0
torch PyPIAll versions2.2.0
pytorch BitnamiAll versions2.2.1
torch-npu PyPIAll versions2.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.

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.

Is CVE-2024-31580 in your software?

Upload an SBOM and sbomify checks it against every vulnerability here, every day.

Check your SBOMs for free