A Leader in the 2025 Gartner® Magic Quadrant™ for Endpoint Protection Platforms. Five years running.A Leader in the Gartner® Magic Quadrant™Read the Report
Experiencing a Breach?Blog
Get StartedContact Us
SentinelOne
  • Platform
    Platform Overview
    • Singularity Platform
      Welcome to Integrated Enterprise Security
    • AI Security Portfolio
      Leading the Way in AI-Powered Security Solutions
    • How It Works
      The Singularity XDR Difference
    • Singularity Marketplace
      One-Click Integrations to Unlock the Power of XDR
    • Pricing & Packaging
      Comparisons and Guidance at a Glance
    Data & AI
    • Purple AI
      Accelerate SecOps with Generative AI
    • Singularity Hyperautomation
      Easily Automate Security Processes
    • AI-SIEM
      The AI SIEM for the Autonomous SOC
    • Singularity Data Lake
      AI-Powered, Unified Data Lake
    • Singularity Data Lake for Log Analytics
      Seamlessly Ingest Data from On-Prem, Cloud or Hybrid Environments
    Endpoint Security
    • Singularity Endpoint
      Autonomous Prevention, Detection, and Response
    • Singularity XDR
      Native & Open Protection, Detection, and Response
    • Singularity RemoteOps Forensics
      Orchestrate Forensics at Scale
    • Singularity Threat Intelligence
      Comprehensive Adversary Intelligence
    • Singularity Vulnerability Management
      Application & OS Vulnerability Management
    • Singularity Identity
      Identity Threat Detection and Response
    Cloud Security
    • Singularity Cloud Security
      Block Attacks with an AI-powered CNAPP
    • Singularity Cloud Native Security
      Secure Cloud and Development Resources
    • Singularity Cloud Workload Security
      Real-Time Cloud Workload Protection Platform
    • Singularity Cloud Data Security
      AI-Powered Threat Detection for Cloud Storage
    • Singularity Cloud Security Posture Management
      Detect and Remediate Cloud Misconfigurations
    Securing AI
    • Prompt Security
      Secure AI Tools Across Your Enterprise
  • Why SentinelOne?
    Why SentinelOne?
    • Why SentinelOne?
      Cybersecurity Built for What’s Next
    • Our Customers
      Trusted by the World’s Leading Enterprises
    • Industry Recognition
      Tested and Proven by the Experts
    • About Us
      The Industry Leader in Autonomous Cybersecurity
    Compare SentinelOne
    • Arctic Wolf
    • Broadcom
    • CrowdStrike
    • Cybereason
    • Microsoft
    • Palo Alto Networks
    • Sophos
    • Splunk
    • Trellix
    • Trend Micro
    • Wiz
    Verticals
    • Energy
    • Federal Government
    • Finance
    • Healthcare
    • Higher Education
    • K-12 Education
    • Manufacturing
    • Retail
    • State and Local Government
  • Services
    Managed Services
    • Managed Services Overview
      Wayfinder Threat Detection & Response
    • Threat Hunting
      World-Class Expertise and Threat Intelligence
    • Managed Detection & Response
      24/7/365 Expert MDR Across Your Entire Environment
    • Incident Readiness & Response
      Digital Forensics, IRR & Breach Readiness
    Support, Deployment, & Health
    • Technical Account Management
      Customer Success with Personalized Service
    • SentinelOne GO
      Guided Onboarding & Deployment Advisory
    • SentinelOne University
      Live and On-Demand Training
    • Services Overview
      Comprehensive Solutions for Seamless Security Operations
    • SentinelOne Community
      Community Login
  • Partners
    Our Network
    • MSSP Partners
      Succeed Faster with SentinelOne
    • Singularity Marketplace
      Extend the Power of S1 Technology
    • Cyber Risk Partners
      Enlist Pro Response and Advisory Teams
    • Technology Alliances
      Integrated, Enterprise-Scale Solutions
    • SentinelOne for AWS
      Hosted in AWS Regions Around the World
    • Channel Partners
      Deliver the Right Solutions, Together
    • Partner Locator
      Your Go-to Source for Our Top Partners in Your Region
    Partner Portal→
  • Resources
    Resource Center
    • Case Studies
    • Data Sheets
    • eBooks
    • Reports
    • Videos
    • Webinars
    • Whitepapers
    • Events
    View All Resources→
    Blog
    • Feature Spotlight
    • For CISO/CIO
    • From the Front Lines
    • Identity
    • Cloud
    • macOS
    • SentinelOne Blog
    Blog→
    Tech Resources
    • SentinelLABS
    • Ransomware Anthology
    • Cybersecurity 101
  • About
    About SentinelOne
    • About SentinelOne
      The Industry Leader in Cybersecurity
    • Investor Relations
      Financial Information & Events
    • SentinelLABS
      Threat Research for the Modern Threat Hunter
    • Careers
      The Latest Job Opportunities
    • Press & News
      Company Announcements
    • Cybersecurity Blog
      The Latest Cybersecurity Threats, News, & More
    • FAQ
      Get Answers to Our Most Frequently Asked Questions
    • DataSet
      The Live Data Platform
    • S Foundation
      Securing a Safer Future for All
    • S Ventures
      Investing in the Next Generation of Security, Data and AI
  • Pricing
Get StartedContact Us
CVE Vulnerability Database
Vulnerability Database/CVE-2024-31580

CVE-2024-31580: PyTorch Heap Buffer Overflow DoS Flaw

CVE-2024-31580 is a heap buffer overflow vulnerability in PyTorch that enables attackers to trigger denial of service attacks. This article covers the technical details, affected versions, security impact, and mitigation.

Updated: January 22, 2026

CVE-2024-31580 Overview

A heap buffer overflow vulnerability was discovered in PyTorch before version v2.2.0 within the /runtime/vararg_functions.cpp component. This vulnerability allows attackers to cause a Denial of Service (DoS) via a crafted input that triggers an out-of-bounds read operation in the heap memory.

Critical Impact

Attackers can exploit this heap buffer overflow to crash PyTorch applications, potentially disrupting machine learning pipelines, AI inference services, and research environments that depend on PyTorch.

Affected Products

  • Linux Foundation PyTorch versions prior to v2.2.0
  • PyTorch Python packages (cpe:2.3:a:linuxfoundation:pytorch:*:*:*:*:*:python:*:*)
  • Applications and services utilizing vulnerable PyTorch runtime components

Discovery Timeline

  • 2024-04-17 - CVE-2024-31580 published to NVD
  • 2025-06-10 - Last updated in NVD database

Technical Details for CVE-2024-31580

Vulnerability Analysis

This vulnerability is classified as CWE-122 (Heap-based Buffer Overflow). The flaw exists in PyTorch's JIT (Just-In-Time) runtime, specifically within the tupleConstruct function in vararg_functions.cpp. The vulnerability was identified through fuzzing efforts targeting the torch JIT lite interpreter, which revealed a read-heap-buffer-overflow condition.

The root cause stems from insufficient bounds checking when constructing tuples from the stack. When the tupleConstruct function is called with a num_inputs parameter that exceeds the actual stack size, the function attempts to read beyond the allocated heap buffer, resulting in an out-of-bounds memory access.

Root Cause

The tupleConstruct function in /runtime/vararg_functions.cpp did not validate that the requested number of inputs (num_inputs) was within the bounds of the available stack size before attempting to read from the stack. This missing validation allowed attackers to supply a crafted input that specified more inputs than were actually present, causing the function to read past the end of the heap-allocated stack buffer.

Attack Vector

The attack requires local access to execute. An attacker can craft malicious input that specifies an invalid number of inputs to the tuple construction operation. When the PyTorch JIT runtime processes this input, it attempts to read from memory locations outside the allocated buffer boundaries, triggering the heap buffer overflow and causing application termination.

cpp
 }
 
 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());

Source: GitHub PyTorch Commit

The patch adds explicit bounds checking to validate that num_inputs does not exceed stack.size() before proceeding with the tuple construction operation.

Detection Methods for CVE-2024-31580

Indicators of Compromise

  • Unexpected crashes or segmentation faults in PyTorch-based applications
  • Application logs showing heap-related memory errors or buffer overflows
  • Abnormal termination of machine learning inference services without clear cause
  • Core dumps indicating memory access violations in vararg_functions.cpp

Detection Strategies

  • Monitor application stability for PyTorch-dependent services experiencing unexpected crashes
  • Implement memory sanitizer tools (AddressSanitizer, Valgrind) in development and staging environments to detect heap overflow conditions
  • Review application logs for TORCH_CHECK failures or memory access exceptions
  • Deploy runtime application self-protection (RASP) solutions that can detect memory corruption attempts

Monitoring Recommendations

  • Enable heap buffer overflow detection through compiler instrumentation (-fsanitize=address) during testing
  • Set up alerting for repeated PyTorch application crashes in production environments
  • Monitor system stability metrics for services running vulnerable PyTorch versions
  • Implement application health checks that can detect denial of service conditions

How to Mitigate CVE-2024-31580

Immediate Actions Required

  • Upgrade PyTorch to version v2.2.0 or later immediately
  • Audit all systems and containers running PyTorch to identify vulnerable versions
  • Review deployment pipelines to ensure patched versions are being deployed
  • Implement input validation for any external data processed by PyTorch applications

Patch Information

The Linux Foundation has addressed this vulnerability in PyTorch v2.2.0. The fix adds explicit bounds checking to validate the number of inputs before tuple construction operations. The security patch is available through the official PyTorch commit.

Organizations should update their PyTorch installations using standard package management:

Workarounds

  • Restrict local access to systems running PyTorch applications to trusted users only
  • Implement input sanitization and validation for any externally-sourced data processed by PyTorch
  • Deploy containerized PyTorch applications with restricted memory access permissions
  • Consider running PyTorch workloads in sandboxed environments to limit the impact of potential crashes
bash
# Upgrade PyTorch to patched version
pip install --upgrade torch>=2.2.0

# Verify installed version
python -c "import torch; print(torch.__version__)"

# For conda environments
conda update pytorch -c pytorch

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

  • Vulnerability Details
  • TypeDOS

  • Vendor/TechPytorch

  • SeverityMEDIUM

  • CVSS Score4.0

  • EPSS Probability0.02%

  • Known ExploitedNo
  • CVSS Vector
  • CVSS:3.1/AV:L/AC:L/PR:N/UI:N/S:U/C:N/I:N/A:L
  • Impact Assessment
  • ConfidentialityLow
  • IntegrityNone
  • AvailabilityLow
  • CWE References
  • CWE-122
  • Technical References
  • GitHub Gist Example Analysis
  • Vendor Resources
  • GitHub PyTorch Commit Note
  • Related CVEs
  • CVE-2025-3730: PyTorch CTC Loss DOS Vulnerability

  • CVE-2025-4287: PyTorch NCCL DoS Vulnerability

  • CVE-2025-2953: PyTorch Denial of Service Vulnerability

  • CVE-2026-24747: PyTorch weights_only RCE Vulnerability
Experience the World’s Most Advanced Cybersecurity Platform

Experience the World’s Most Advanced Cybersecurity Platform

See how our intelligent, autonomous cybersecurity platform can protect your organization now and into the future.

Try SentinelOne
  • Get Started
  • Get a Demo
  • Product Tour
  • Why SentinelOne
  • Pricing & Packaging
  • FAQ
  • Contact
  • Contact Us
  • Customer Support
  • SentinelOne Status
  • Language
  • English
  • Platform
  • Singularity Platform
  • Singularity Endpoint
  • Singularity Cloud
  • Singularity AI-SIEM
  • Singularity Identity
  • Singularity Marketplace
  • Purple AI
  • Services
  • Wayfinder TDR
  • SentinelOne GO
  • Technical Account Management
  • Support Services
  • Verticals
  • Energy
  • Federal Government
  • Finance
  • Healthcare
  • Higher Education
  • K-12 Education
  • Manufacturing
  • Retail
  • State and Local Government
  • Cybersecurity for SMB
  • Resources
  • Blog
  • Labs
  • Case Studies
  • Videos
  • Product Tours
  • Events
  • Cybersecurity 101
  • eBooks
  • Webinars
  • Whitepapers
  • Press
  • News
  • Ransomware Anthology
  • Company
  • About Us
  • Our Customers
  • Careers
  • Partners
  • Legal & Compliance
  • Security & Compliance
  • Investor Relations
  • S Foundation
  • S Ventures

©2026 SentinelOne, All Rights Reserved.

Privacy Notice Terms of Use