PyTorch heap buffer overflow vulnerability
Research is free — Hunters explains how the bug works, the root-cause code pattern, how the fix addresses it, and how to test whether a target is affected, in chat. Investigate & write exploit is a paid run — the engine reads the advisory and fix commits, then builds and validates a working proof-of-concept exploit with reproduction steps.
Affected versions
0 → fixed in 2.2.0
Details
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.
The fix
[fuzzing result][fuzz_torch_jit_lite_interpreter]
torch/csrc/jit/runtime/vararg_functions.cpp+3 −0
@@ -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());
References
- ADVISORYhttps://nvd.nist.gov/vuln/detail/CVE-2024-31580
- WEBhttps://github.com/pytorch/pytorch/commit/b5c3a17c2c207ebefcb85043f0cf94be9b2fef81
- WEBhttps://gist.github.com/1047524396/038c78f2f007345e6f497698ace2aa3d
- WEBhttps://github.com/pypa/advisory-database/tree/main/vulns/torch/PYSEC-2024-252.yaml
- PACKAGEhttps://github.com/pytorch/pytorch
- WEBhttps://security.snyk.io/vuln/SNYK-PYTHON-TORCH-6649934