Junglewise Threat Intelligence

CVE-2025-2999: PyTorch memory corruption in unpack_sequence and pad_packed_sequence

CVE-2025-2999 · Severity: medium · CVSS 5.3 · Published 2025-03-31

Technologies: torch (PyPI), PyTorch. Vendors: PyPI, PyTorch.

Executive brief

PyTorch, a popular machine learning library, is vulnerable to a memory corruption issue when processing certain data sequences. An attacker with local access to a system could exploit this flaw to cause the application to crash or potentially execute unauthorized code. This could lead to service disruptions or unauthorized access to sensitive data handled by the machine learning model.

Technical details

A memory corruption vulnerability (CWE-119) exists in PyTorch's RNN utility functions, specifically torch.nn.utils.rnn.unpack_sequence and torch.nn.utils.rnn.pad_packed_sequence. The issue is triggered when these functions attempt to process a PackedSequence object containing empty data or empty batch sizes, leading to a segmentation fault. A local attacker can exploit this by providing specially crafted input to an application using these functions, potentially achieving arbitrary code execution or causing a denial of service. The vulnerability was addressed in version 2.9.1 by improving error checking for empty tensors.

Affected products

  • PyTorch PyTorch < 2.9.1

Timeline

  • 2025-03-20: disclosed: Issue reported on GitHub
  • 2025-03-31: advisory: CVE-2025-2999 published
  • 2025-03-31: patched: Patch commit 4945180 released

References

Related threats