Skip to main content
CVE Vulnerability Database

CVE-2025-3001: PyTorch Buffer Overflow Vulnerability

CVE-2025-3001 is a critical buffer overflow vulnerability in PyTorch 2.6.0 affecting the torch.lstm_cell function. This memory corruption flaw requires local access but has a public exploit. Learn about affected versions, impact, and mitigation.

Updated:

CVE-2025-3001 Overview

A critical memory corruption vulnerability has been identified in PyTorch version 2.6.0, specifically affecting the torch.lstm_cell function. This vulnerability allows local attackers to manipulate input parameters in a way that triggers memory corruption, potentially leading to application crashes, data corruption, or arbitrary code execution within the context of the affected application.

Critical Impact

Memory corruption in the torch.lstm_cell function can be exploited by local attackers to compromise machine learning workloads and potentially execute malicious code within affected PyTorch environments.

Affected Products

  • PyTorch 2.6.0 (Linux Foundation)
  • Python applications utilizing PyTorch's torch.lstm_cell function
  • Machine learning pipelines and inference systems running the vulnerable version

Discovery Timeline

  • March 31, 2025 - CVE-2025-3001 published to NVD
  • May 29, 2025 - Last updated in NVD database

Technical Details for CVE-2025-3001

Vulnerability Analysis

This vulnerability is classified under CWE-119 (Improper Restriction of Operations within the Bounds of a Memory Buffer). The torch.lstm_cell function in PyTorch 2.6.0 fails to properly validate input boundaries, allowing malformed inputs to trigger memory corruption conditions.

The vulnerability requires local access to exploit, meaning an attacker must have the ability to execute code on the target system or provide malicious input to a PyTorch application processing user-controlled data. When exploited, the memory corruption can lead to confidentiality, integrity, and availability impacts on affected systems.

The exploit for this vulnerability has been disclosed publicly, increasing the risk for organizations running vulnerable PyTorch installations. Machine learning environments processing untrusted data or running multi-tenant workloads are particularly at risk.

Root Cause

The root cause lies in improper memory boundary validation within the torch.lstm_cell function implementation. When processing LSTM (Long Short-Term Memory) cell operations, the function does not adequately verify that input tensor dimensions and memory allocations fall within expected bounds. This allows specially crafted inputs to write or read data outside of allocated memory regions.

Attack Vector

The attack vector is local, requiring the attacker to either have direct access to the system running PyTorch or the ability to influence inputs processed by a vulnerable PyTorch application. Attack scenarios include:

The vulnerability can be triggered by providing malformed tensor inputs to the torch.lstm_cell function. An attacker with local access could craft malicious input data that, when processed by an LSTM cell operation, causes the function to access memory outside its intended bounds. This could occur in scenarios where PyTorch applications process data from untrusted sources without proper input validation.

For technical details on the vulnerability mechanism, refer to the GitHub PyTorch Issue #149626 which documents the memory corruption behavior.

Detection Methods for CVE-2025-3001

Indicators of Compromise

  • Unexpected application crashes or segmentation faults in PyTorch processes when executing LSTM operations
  • Memory access violations or core dumps associated with torch.lstm_cell function calls
  • Anomalous memory consumption patterns in machine learning workloads
  • Suspicious tensor manipulation patterns preceding application failures

Detection Strategies

  • Monitor PyTorch applications for abnormal termination signals (SIGSEGV, SIGABRT) during LSTM operations
  • Implement runtime memory sanitizers (AddressSanitizer, MemorySanitizer) in development and testing environments
  • Deploy application logging to capture tensor shapes and dimensions passed to LSTM functions
  • Utilize SentinelOne's behavioral AI to detect memory corruption exploitation attempts

Monitoring Recommendations

  • Enable crash reporting and memory dump analysis for PyTorch-based applications
  • Implement input validation logging for machine learning inference endpoints
  • Configure alerting on repeated application failures involving LSTM operations
  • Monitor system logs for memory-related errors in Python/PyTorch processes

How to Mitigate CVE-2025-3001

Immediate Actions Required

  • Identify all systems running PyTorch version 2.6.0 in your environment
  • Evaluate exposure by determining if applications process untrusted input through LSTM functions
  • Implement input validation to sanitize tensor dimensions before passing to torch.lstm_cell
  • Consider restricting access to machine learning environments until patching is complete

Patch Information

Organizations should monitor the PyTorch GitHub repository for official patches and security updates addressing this vulnerability. Upgrade to a patched version as soon as one becomes available from the Linux Foundation PyTorch project.

Additional technical details and tracking information can be found at VulDB #302050.

Workarounds

  • Implement strict input validation on all tensor data before processing with torch.lstm_cell
  • Isolate PyTorch workloads in containerized environments with restricted memory access
  • Run PyTorch applications with reduced privileges to limit exploitation impact
  • Consider using alternative LSTM implementations while awaiting an official patch
bash
# Example: Restricting PyTorch container memory access
docker run --memory="4g" --memory-swap="4g" \
  --security-opt=no-new-privileges \
  --cap-drop=ALL \
  pytorch-app:latest

Disclaimer: This content was generated using AI. While we strive for accuracy, please verify critical information with official sources.

Default Legacy - Prefooter | Experience the World’s Most Advanced Cybersecurity Platform

Experience the Most Advanced Cybersecurity Platform

See how the world’s most intelligent, autonomous cybersecurity platform can protect your organization today and into the future.