The SentinelOne Annual Threat Report - A Defenders Guide from the FrontlinesThe SentinelOne Annual Threat ReportGet the Report
Experiencing a Breach?Blog
Get StartedContact Us
SentinelOne
  • Platform
    Platform Overview
    • Singularity Platform
      Welcome to Integrated Enterprise Security
    • AI for Security
      Leading the Way in AI-Powered Security Solutions
    • Securing AI
      Accelerate AI Adoption with Secure AI Tools, Apps, and Agents.
    • 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
    • AI Data Pipelines
      Security Data Pipeline for AI SIEM and Data Optimization
    • 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
      DFIR, Breach Readiness, & Compromise Assessments
    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
    • SentinelOne for Google Cloud
      Unified, Autonomous Security Giving Defenders the Advantage at Global Scale
    • 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-2026-31214

CVE-2026-31214: ml-engineering torch-checkpoint RCE Flaw

CVE-2026-31214 is an insecure deserialization flaw in the ml-engineering torch-checkpoint-shrink.py script that enables remote code execution through malicious checkpoint files. This article covers technical details, impact, and mitigation.

Published: May 17, 2026

CVE-2026-31214 Overview

CVE-2026-31214 is an insecure deserialization vulnerability [CWE-502] in the torch-checkpoint-shrink.py script from the ml-engineering project. The vulnerable code exists in commit 0099885db36a8f06556efe1faf552518852cb1e0. The script calls torch.load() on PyTorch checkpoint files without setting weights_only=True. This allows the underlying pickle module to deserialize arbitrary Python objects supplied by an attacker. A remote attacker who delivers a crafted .pt checkpoint file can achieve arbitrary code execution as the user running the script. Machine learning workflows that consume third-party checkpoints face direct exposure.

Critical Impact

Loading an attacker-supplied PyTorch checkpoint triggers arbitrary code execution in the context of the user running torch-checkpoint-shrink.py.

Affected Products

  • ml-engineering project, torch-checkpoint-shrink.py script
  • Commit 0099885db36a8f06556efe1faf552518852cb1e0 and earlier revisions containing the unsafe torch.load() call
  • Any downstream tooling or pipeline that invokes this script on untrusted .pt files

Discovery Timeline

  • 2026-05-12 - CVE-2026-31214 published to NVD
  • 2026-05-13 - Last updated in NVD database

Technical Details for CVE-2026-31214

Vulnerability Analysis

The vulnerability lives in the checkpoint loading path of torch-checkpoint-shrink.py. The script uses torch.load() to read PyTorch checkpoint files with the .pt extension. PyTorch's torch.load() defaults to using Python's pickle module for deserialization when weights_only=True is not explicitly set. The pickle format permits embedded objects whose constructors execute arbitrary Python code during unpickling. An attacker who controls a checkpoint file can therefore run code on the host that processes it. The attack vector is network-reachable because checkpoint files are routinely downloaded from model hubs, shared via collaboration platforms, or pulled from artifact registries.

Root Cause

The root cause is the absence of the weights_only=True parameter on the torch.load() invocation at line 57 of the script. Without that flag, PyTorch falls back to the legacy pickle-based loader. The legacy loader does not constrain which classes or callables can be reconstructed during deserialization. Trust is implicitly granted to whoever produced the checkpoint.

Attack Vector

An attacker crafts a malicious .pt file containing a pickle payload that defines a __reduce__ method returning a callable such as os.system or subprocess.Popen with attacker-controlled arguments. The attacker distributes the file through a model repository, a shared bucket, or a download link. When a victim runs torch-checkpoint-shrink.py against the file, torch.load() invokes the pickle deserializer, which executes the embedded callable. Code runs with the privileges of the user executing the script. See the GitHub Script Example for the affected call site.

Detection Methods for CVE-2026-31214

Indicators of Compromise

  • Unexpected child processes spawned by Python interpreters running torch-checkpoint-shrink.py, such as shells, curl, wget, or package managers
  • Outbound network connections from Python processes immediately after a checkpoint load operation
  • New files written under home directories, /tmp, or model cache paths during checkpoint processing
  • .pt files originating from untrusted sources or with anomalous size relative to declared model dimensions

Detection Strategies

  • Hunt process trees where python parents non-ML utilities like /bin/sh, bash, nc, or powershell during checkpoint loading windows
  • Inspect .pt files for suspicious opcodes by scanning pickle streams for GLOBAL references to modules such as os, subprocess, posix, or builtins
  • Flag torch.load() call sites in code review and CI scanning that omit weights_only=True
  • Correlate file download events for .pt artifacts with subsequent process and network activity on the same host

Monitoring Recommendations

  • Enable command-line and process-creation auditing on ML training and inference hosts
  • Log all file reads of .pt and .pth artifacts and the user account performing the load
  • Alert on Python processes initiating outbound TCP connections to non-allowlisted destinations
  • Track integrity hashes of checkpoint files against a known-good registry before consumption

How to Mitigate CVE-2026-31214

Immediate Actions Required

  • Stop running torch-checkpoint-shrink.py against checkpoints from untrusted or unverified sources
  • Patch the script locally by adding weights_only=True to the torch.load() call at line 57
  • Audit the repository for additional torch.load() usages that omit the safe-loading flag
  • Quarantine .pt files received from external collaborators until they are scanned and validated

Patch Information

No upstream patch is currently referenced in the NVD record. Apply a local fix by modifying the torch.load() invocation to pass weights_only=True, which restricts deserialization to tensor data and rejects arbitrary Python objects. PyTorch versions 2.6 and later enable this behavior by default, but the script's explicit call pattern should still set the parameter for clarity and backward compatibility. Track the upstream repository at the ml-engineering project for any forthcoming fix.

Workarounds

  • Run the script inside an ephemeral container or sandbox with no network egress and no access to credentials
  • Pre-validate checkpoint files by loading them with weights_only=True in an isolated process before any conversion step
  • Restrict execution to dedicated service accounts without write access to source code or secrets
  • Enforce checksum verification against a trusted manifest for every .pt artifact entering the pipeline
bash
# Configuration example: safe-load wrapper
python -c "import torch; torch.load('checkpoint.pt', map_location='cpu', weights_only=True)"

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

  • Vulnerability Details
  • TypeRCE

  • Vendor/TechPytorch

  • SeverityCRITICAL

  • CVSS Score9.8

  • EPSS Probability0.39%

  • Known ExploitedNo
  • CVSS Vector
  • CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:H/A:H
  • Impact Assessment
  • ConfidentialityLow
  • IntegrityNone
  • AvailabilityHigh
  • CWE References
  • CWE-502
  • Technical References
  • GitHub Script Example

  • Notion CVE-2026-31214 Reference
  • Related CVEs
  • CVE-2026-31249: CosyVoice RCE Vulnerability

  • CVE-2026-24747: PyTorch weights_only RCE Vulnerability

  • CVE-2024-48063: PyTorch RemoteModule RCE Vulnerability

  • CVE-2025-2148: PyTorch Memory Corruption RCE Vulnerability
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.

Try SentinelOne
  • Get Started
  • Get a Demo
  • Product Tour
  • Why SentinelOne
  • Pricing & Packaging
  • FAQ
  • Contact
  • Contact Us
  • Customer Support
  • SentinelOne Status
  • Language
  • 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

English