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
    • 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-1839

CVE-2026-1839: HuggingFace Transformers RCE Vulnerability

CVE-2026-1839 is a remote code execution vulnerability in HuggingFace Transformers library affecting the Trainer class. Malicious checkpoint files can execute arbitrary code. This article covers technical details, affected versions, impact, and mitigation strategies.

Published: April 10, 2026

CVE-2026-1839 Overview

A vulnerability in the HuggingFace Transformers library, specifically in the Trainer class, allows for arbitrary code execution through insecure deserialization. The _load_rng_state() method in src/transformers/trainer.py at line 3059 calls torch.load() without the weights_only=True parameter. This issue affects all versions of the library supporting torch>=2.2 when used with PyTorch versions below 2.6, as the safe_globals() context manager provides no protection in these versions. An attacker can exploit this vulnerability by supplying a malicious checkpoint file, such as rng_state.pth, which can execute arbitrary code when loaded.

Critical Impact

Attackers can achieve arbitrary code execution by providing a malicious PyTorch checkpoint file, potentially leading to complete system compromise in machine learning training environments.

Affected Products

  • HuggingFace Transformers library (versions prior to v5.0.0rc3)
  • Systems using torch>=2.2 with PyTorch versions below 2.6
  • Applications utilizing the Trainer class for model training

Discovery Timeline

  • 2026-04-07 - CVE CVE-2026-1839 published to NVD
  • 2026-04-07 - Last updated in NVD database

Technical Details for CVE-2026-1839

Vulnerability Analysis

This vulnerability stems from insecure deserialization (CWE-502) in the HuggingFace Transformers library's checkpoint loading mechanism. The _load_rng_state() method uses PyTorch's torch.load() function to deserialize random number generator state files without enabling safe loading restrictions.

PyTorch's torch.load() function by default uses Python's pickle module for deserialization, which is inherently unsafe when processing untrusted data. The pickle protocol allows arbitrary Python code execution during the deserialization process, making any unsanitized torch.load() call a potential code execution vector.

While the code wraps the call in a safe_globals() context manager, this protection mechanism is ineffective for PyTorch versions below 2.6. The vulnerability requires local access and user interaction to trigger, as the attacker must convince a victim to load a malicious checkpoint file.

Root Cause

The root cause is the unsafe usage of torch.load() without the weights_only=True parameter in the _load_rng_state() method. When loading checkpoint files such as rng_state.pth, the function deserializes the entire pickle payload, which can contain malicious code objects. The safe_globals() context manager was intended to provide protection but fails to do so on PyTorch versions below 2.6, leaving a significant attack surface for environments using older PyTorch releases.

Attack Vector

The attack requires local access and involves social engineering or supply chain compromise. An attacker can craft a malicious rng_state.pth file containing arbitrary Python code embedded in the pickle payload. When a victim loads this checkpoint—either by resuming training from a compromised checkpoint directory or by downloading a malicious pre-trained model—the code executes with the privileges of the training process.

The following patch demonstrates the security fix applied in version v5.0.0rc3:

python
                 return
 
         with safe_globals():
-            checkpoint_rng_state = torch.load(rng_file)
+            check_torch_load_is_safe()
+            checkpoint_rng_state = torch.load(rng_file, weights_only=True)
         random.setstate(checkpoint_rng_state["python"])
         np.random.set_state(checkpoint_rng_state["numpy"])
         torch.random.set_rng_state(checkpoint_rng_state["cpu"])

Source: GitHub Commit Update

Detection Methods for CVE-2026-1839

Indicators of Compromise

  • Unexpected rng_state.pth or similar checkpoint files appearing in training directories
  • Unusual process spawning or network connections originating from Python training processes
  • Modified or tampered checkpoint files with unexpected file sizes or creation timestamps

Detection Strategies

  • Monitor for calls to torch.load() without the weights_only=True parameter in application logs
  • Implement file integrity monitoring on checkpoint directories to detect unauthorized modifications
  • Use static code analysis tools to identify insecure torch.load() usage patterns in Python codebases
  • Deploy endpoint detection to alert on suspicious child process creation from ML training workloads

Monitoring Recommendations

  • Enable verbose logging for the HuggingFace Transformers library during training operations
  • Implement checksum verification for all checkpoint files before loading
  • Monitor ML training environments for unexpected file system modifications in checkpoint directories
  • Review training job outputs for anomalous behaviors such as unauthorized network connections

How to Mitigate CVE-2026-1839

Immediate Actions Required

  • Upgrade HuggingFace Transformers to version v5.0.0rc3 or later
  • Upgrade PyTorch to version 2.6 or later to enable effective safe_globals() protection
  • Audit existing checkpoint files for potential tampering before resuming any training jobs
  • Implement strict source validation for all pre-trained models and checkpoints

Patch Information

The vulnerability is resolved in HuggingFace Transformers version v5.0.0rc3. The fix adds the weights_only=True parameter to the torch.load() call and introduces additional safety checks via the check_torch_load_is_safe() function. Organizations should update to this version or later immediately.

For detailed patch information, refer to the GitHub Commit Update. Additional vulnerability details are available at the Huntr Bug Bounty Listing.

Workarounds

  • Manually patch the _load_rng_state() method to add weights_only=True to the torch.load() call
  • Avoid loading checkpoint files from untrusted sources until the library is updated
  • Isolate ML training environments in sandboxed containers with restricted permissions
  • Disable checkpoint resumption functionality if not required for operations
bash
# Upgrade HuggingFace Transformers to the patched version
pip install --upgrade transformers>=5.0.0rc3

# Upgrade PyTorch to version 2.6 or later for additional protections
pip install --upgrade torch>=2.6

# Verify installed versions
pip show transformers torch | grep -E "^(Name|Version)"

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

  • Vulnerability Details
  • TypeRCE

  • Vendor/TechHuggingface Transformers

  • SeverityMEDIUM

  • CVSS Score6.5

  • EPSS Probability0.02%

  • Known ExploitedNo
  • CVSS Vector
  • CVSS:3.0/AV:L/AC:H/PR:N/UI:R/S:U/C:H/I:L/A:H
  • Impact Assessment
  • ConfidentialityHigh
  • IntegrityLow
  • AvailabilityHigh
  • CWE References
  • CWE-502
  • Technical References
  • GitHub Commit Update

  • Huntr Bug Bounty Listing
  • Related CVEs
  • CVE-2024-3568: Huggingface Transformers RCE Vulnerability

  • CVE-2024-11392: Huggingface Transformers RCE Vulnerability

  • CVE-2024-11393: Hugging Face Transformers RCE Vulnerability

  • CVE-2024-11394: Hugging Face Transformers RCE Vulnerability
Default Legacy - Prefooter | 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
  • 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