CVE-2024-31580
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.
AI Insight
LLM-synthesized narrative grounded in this CVE's description and references.
Heap buffer overflow in PyTorch before v2.2.0 in vararg_functions.cpp allows denial of service via crafted input.
Overview
PyTorch versions before v2.2.0 contain a heap buffer overflow vulnerability in the /runtime/vararg_functions.cpp component [2]. The bug is triggered by a crafted input that causes out-of-bounds memory access.
Exploitation
An attacker can exploit this by providing a specially crafted input to a vulnerable PyTorch installation. No authentication is required if the attacker can supply input to the affected function, potentially through a network service or data processing pipeline [2].
Impact
Successful exploitation leads to a denial of service (DoS) due to heap memory corruption. The overflow may also cause undefined behavior, but the primary reported impact is service disruption [2][4].
Mitigation
The vulnerability has been fixed in PyTorch v2.2.0. Users should upgrade to this version or later. A specific patch commit is available in the PyTorch repository [4].
AI Insight generated on May 20, 2026. Synthesized from this CVE's description and the cited reference URLs; citations are validated against the source bundle.
Affected packages
Versions sourced from the GitHub Security Advisory.
| Package | Affected versions | Patched versions |
|---|---|---|
torchPyPI | < 2.2.0 | 2.2.0 |
Affected products
3- PyTorch/PyTorchdescription
- osv-coords2 versions
< 2.2.1+ 1 more
- (no CPE)range: < 2.2.1
- (no CPE)range: < 2.2.0
Patches
1b5c3a17c2c20[fuzzing result][fuzz_torch_jit_lite_interpreter] read-heap-buffer-overflow-far-from-bounds (size 4) in c10::IValue::IValue() (#110441)
1 file changed · +3 −0
torch/csrc/jit/runtime/vararg_functions.cpp+3 −0 modified@@ -267,6 +267,9 @@ void listUnpack(Stack& stack, size_t num_outputs) { } void tupleConstruct(Stack& stack, size_t num_inputs) { + if (num_inputs > stack.size()) { + TORCH_CHECK(false, "Invalid number of inputs: ", num_inputs); + } switch (num_inputs) { case 0: stack.emplace_back(c10::ivalue::Tuple::create());
Vulnerability mechanics
Generated on May 9, 2026. Inputs: CWE entries + fix-commit diffs from this CVE's patches. Citations validated against bundle.
References
6- github.com/advisories/GHSA-5pcm-hx3q-hm94ghsaADVISORY
- nvd.nist.gov/vuln/detail/CVE-2024-31580ghsaADVISORY
- gist.github.com/1047524396/038c78f2f007345e6f497698ace2aa3dghsaWEB
- github.com/pypa/advisory-database/tree/main/vulns/torch/PYSEC-2024-252.yamlghsaWEB
- github.com/pytorch/pytorch/commit/b5c3a17c2c207ebefcb85043f0cf94be9b2fef81ghsaWEB
- security.snyk.io/vuln/SNYK-PYTHON-TORCH-6649934ghsaWEB
News mentions
0No linked articles in our index yet.