CVE-2025-2999: Torch PyTorch Is Vulnerable To Memory Vulnerability

MODERATE
Advisory Identifier: GHSA-vgrw-7cvw-pwgx
CVSS 5.3
CWE-119
Published
Advisory Summary

CVE-2025-2999 is a MODERATE (CVSS 5.3) pytorch is vulnerable to memory vulnerability (CWE-119: Improper Restriction of Operations within the Bounds of a Memory Buffer) affecting Torch libraries in the PyPI ecosystem. The issue involves pytorch is vulnerable to memory corruption through its unpack_sequence function. Remediation is available by upgrading affected packages to version 2.9.1.

CVE-2025-2999 at a Glance

CVE Identifier CVE-2025-2999
GHSA Identifier GHSA-vgrw-7cvw-pwgx
Severity MODERATE
CVSS v3.1 Base Score 5.3
CWE Classification CWE-119: Improper Restriction of Operations within the Bounds of a Memory Buffer
Affected Product Torch
Package Ecosystem PyPI
Published Date
Last Updated

Security Impact

CVSS: 5.3

The security impact metrics below are parsed directly from the CVSS v3.1 vector string (CVSS:3.1/AV:L/AC:L/PR:L/UI:N/S:U/C:L/I:L/A:L).

Attack Vector Local (AV:L)
Attack Complexity Low (AC:L)
Privileges Required Low (PR:L)
User Interaction None (UI:N)
Scope Unchanged (S:U)
Confidentiality Low (C:L)
Integrity Low (I:L)
Availability Low (A:L)

How to Fix CVE-2025-2999

To remediate this vulnerability, upgrade all affected Torch dependencies to a patched release. Both direct and transitive dependencies should be checked, as frameworks or security libraries may pull in vulnerable versions transitively.

torch fixed: 2.9.1
pip install torch>=2.9.1
Verify Direct and Transitive Dependencies

Run the following command in your project directory to verify that all resolved dependencies use the patched release:

pip show torch

How to Check if You Are Affected

To determine whether your Python environment is affected by CVE-2025-2999, inspect your installed packages using pip:

pip show torch

Analyze the terminal output to locate any version of Torch in your dependency tree. If any resolved version matches the vulnerable ranges listed in the table below (for example, versions earlier than 2.9.1), your application is affected.

Note: The pip show torch command checks currently installed packages in your active Python environment.

Technical Details

Vulnerability Mechanism & Technical Analysis

This vulnerability is classified under CWE-119: Improper Restriction of Operations within the Bounds of a Memory Buffer, where the product performs operations on a memory buffer, but it reads from or writes to a memory location outside the buffer's intended boundary. this may result in read or write operations on unexpected memory locations that could be linked to other variables, data structures, or internal program data. In Torch, software state validation or input boundaries are circumvented during processing. Review the official source advisory statement below for specific affected components, classes, and reproduction details.

Source Advisory Statement

A vulnerability was found in PyTorch 2.6.0. It has been rated as critical. Affected by this issue is the function torch.nn.utils.rnn.unpack_sequence. The manipulation leads to memory corruption. Attacking locally is a requirement. The exploit has been disclosed to the public and may be used. A patch is available through commit [4945180](https://github.com/pytorch/pytorch/commit/494518046816d29099b7d056a74ffa5c244fdcdd).

CVE-2025-2999 Affected Torch Versions

1 component(s)
Fixed Versions:
2.9.1
Product / Package Ecosystem Affected Versions Fixed Version
torch
PyPI
< 2.9.1
2.9.1

References

Frequently Asked Questions

What is CVE-2025-2999?
CVE-2025-2999 is a security vulnerability in Torch involving PyTorch is vulnerable to memory corruption through its unpack_sequence function under CWE-119: Improper Restriction of Operations within the Bounds of a Memory Buffer.
Which Torch versions are affected?
Affected versions include releases prior to 2.9.1 across affected packages: torch.
What version fixes CVE-2025-2999?
Upgrading to 2.9.1 (or the latest patched release for your respective branch) resolves the vulnerability.
Is torch affected?
Yes, torch is affected in releases prior to 2.9.1. Upgrade your dependency to 2.9.1 or later.
What is the CVSS score of CVE-2025-2999?
CVE-2025-2999 has a CVSS v3.1 base score of 5.3 (MODERATE) with vector string CVSS:3.1/AV:L/AC:L/PR:L/UI:N/S:U/C:L/I:L/A:L.
What CWE is associated with CVE-2025-2999?
CVE-2025-2999 is classified under CWE-119: Improper Restriction of Operations within the Bounds of a Memory Buffer (The product performs operations on a memory buffer, but it reads from or writes to a memory location outside the buffer's intended boundary. This may result in read or write operations on unexpected memory locations that could be linked to other variables, data structures, or internal program data.).
How can I check PyPI dependencies for CVE-2025-2999?
Run the dependency tree command: 'pip show torch'. This command lists direct and transitive dependencies in your build configuration so you can verify if a vulnerable version is resolved.
Machine-readable OSV JSON OSV v1.5 Schema
Normalized schema output
{
  "schema_version" : "1.4.0",
  "id" : "GHSA-vgrw-7cvw-pwgx",
  "modified" : "2026-06-10T17:25:19Z",
  "published" : "2025-03-31T15:30:48Z",
  "aliases" : [ "CVE-2025-2999" ],
  "summary" : "PyTorch is vulnerable to memory corruption through its unpack_sequence function",
  "details" : "A vulnerability was found in PyTorch 2.6.0. It has been rated as critical. Affected by this issue is the function torch.nn.utils.rnn.unpack_sequence. The manipulation leads to memory corruption. Attacking locally is a requirement. The exploit has been disclosed to the public and may be used.\n\nA patch is available through commit [4945180](https://github.com/pytorch/pytorch/commit/494518046816d29099b7d056a74ffa5c244fdcdd).",
  "severity" : [ {
    "type" : "CVSS_V3",
    "score" : "CVSS:3.1/AV:L/AC:L/PR:L/UI:N/S:U/C:L/I:L/A:L"
  }, {
    "type" : "CVSS_V4",
    "score" : "CVSS:4.0/AV:L/AC:L/AT:N/PR:L/UI:N/VC:L/VI:L/VA:L/SC:N/SI:N/SA:N"
  } ],
  "affected" : [ {
    "package" : {
      "ecosystem" : "PyPI",
      "name" : "torch"
    },
    "ranges" : [ {
      "type" : "ECOSYSTEM",
      "events" : [ {
        "introduced" : "0"
      }, {
        "fixed" : "2.9.1"
      } ]
    } ]
  } ],
  "references" : [ {
    "type" : "ADVISORY",
    "url" : "https://nvd.nist.gov/vuln/detail/CVE-2025-2999"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/pytorch/pytorch/issues/149622"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/pytorch/pytorch/issues/149622#issue-2935495265"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/pytorch/pytorch/commit/494518046816d29099b7d056a74ffa5c244fdcdd"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/pypa/advisory-database/tree/main/vulns/torch/PYSEC-2025-193.yaml"
  }, {
    "type" : "PACKAGE",
    "url" : "https://github.com/pytorch/pytorch"
  }, {
    "type" : "WEB",
    "url" : "https://vuldb.com/?ctiid.302048"
  }, {
    "type" : "WEB",
    "url" : "https://vuldb.com/?id.302048"
  }, {
    "type" : "WEB",
    "url" : "https://vuldb.com/?submit.524198"
  } ],
  "database_specific" : {
    "cwe_ids" : [ "CWE-119" ],
    "severity" : "MODERATE",
    "github_reviewed" : true,
    "github_reviewed_at" : "2026-06-10T17:25:19Z",
    "nvd_published_at" : "2025-03-31T15:15:44Z"
  }
}