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
    • 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-2023-6730

CVE-2023-6730: Huggingface Transformers Deserialization Flaw

CVE-2023-6730 is a deserialization of untrusted data vulnerability in Huggingface Transformers prior to version 4.36. This flaw enables attackers to execute malicious code. This article covers technical details, impact, and fixes.

Published: February 4, 2026

CVE-2023-6730 Overview

CVE-2023-6730 is an insecure deserialization vulnerability affecting the Hugging Face Transformers library prior to version 4.36. The vulnerability stems from unsafe use of Python's pickle.load function, which can deserialize untrusted data and lead to arbitrary code execution when processing malicious model files or data.

Critical Impact

Attackers can achieve remote code execution by crafting malicious pickle objects that execute arbitrary Python code when deserialized by the Transformers library, potentially compromising machine learning pipelines and AI infrastructure.

Affected Products

  • Hugging Face Transformers versions prior to 4.36
  • Applications utilizing the transfo_xl tokenizer module
  • Systems using RAG (Retrieval-Augmented Generation) retrieval components

Discovery Timeline

  • 2023-12-19 - CVE-2023-6730 published to NVD
  • 2024-11-21 - Last updated in NVD database

Technical Details for CVE-2023-6730

Vulnerability Analysis

This insecure deserialization vulnerability exists in the Hugging Face Transformers library where pickle.load operations were performed without proper security controls. Python's pickle module is inherently unsafe when handling untrusted data because it can execute arbitrary code during the deserialization process. The vulnerability affects multiple components within the library, including the deprecated transfo_xl tokenizer and the RAG retrieval module.

The attack requires low privileges to execute and can be performed over the network without user interaction. Successful exploitation results in complete compromise of confidentiality, integrity, and availability of the affected system, making it particularly dangerous in ML/AI environments where model files are frequently loaded from external sources.

Root Cause

The root cause is the unrestricted use of pickle.load to deserialize data without verifying the source or content of the serialized objects. Python's pickle protocol allows arbitrary code execution during deserialization, and the Transformers library did not implement adequate safeguards to prevent malicious payloads from being processed. The vulnerable code paths lacked a trust verification mechanism before executing deserialization operations.

Attack Vector

An attacker can exploit this vulnerability by crafting a malicious pickle file containing embedded Python code and tricking the target system into loading it as a model or tokenizer component. Attack scenarios include:

  1. Publishing a trojanized model on the Hugging Face Hub or other model repositories
  2. Man-in-the-middle attacks during model downloads
  3. Supply chain attacks through compromised model dependencies
  4. Social engineering users to load malicious local model files

The following patch snippets show how the fix implements the TRUST_REMOTE_CODE environment variable check:

python
     is_torch_available,
     logging,
     requires_backends,
+    strtobool,
     torch_only_method,
 )

Source: GitHub Commit

python
 
 from ...tokenization_utils import PreTrainedTokenizer
 from ...tokenization_utils_base import BatchEncoding
-from ...utils import cached_file, is_datasets_available, is_faiss_available, logging, requires_backends
+from ...utils import cached_file, is_datasets_available, is_faiss_available, logging, requires_backends, strtobool
 from .configuration_rag import RagConfig
 from .tokenization_rag import RagTokenizer

Source: GitHub Commit

The fix introduces the strtobool utility to properly evaluate the TRUST_REMOTE_CODE environment variable, ensuring pickle operations are only permitted when explicitly trusted by the user.

Detection Methods for CVE-2023-6730

Indicators of Compromise

  • Unexpected process spawning from Python ML/AI applications
  • Unusual network connections initiated by Transformers-based applications
  • Suspicious file system access patterns during model loading operations
  • Anomalous system calls during deserialization of model files

Detection Strategies

  • Monitor for pickle deserialization operations on untrusted data sources in Python applications
  • Implement file integrity monitoring for model cache directories (typically ~/.cache/huggingface/)
  • Audit network traffic for downloads of model files from untrusted or unusual sources
  • Deploy runtime application security testing to detect malicious pickle payloads

Monitoring Recommendations

  • Enable verbose logging for Hugging Face Transformers library operations
  • Monitor the TRUST_REMOTE_CODE environment variable usage across systems
  • Implement behavioral analysis for ML pipeline processes to detect post-exploitation activity
  • Track model provenance and verify cryptographic signatures where available

How to Mitigate CVE-2023-6730

Immediate Actions Required

  • Upgrade Hugging Face Transformers to version 4.36 or later immediately
  • Audit all model sources and remove any untrusted or unverified models
  • Set TRUST_REMOTE_CODE=False explicitly in environment configurations
  • Review and restrict model loading operations to trusted repositories only

Patch Information

The vulnerability has been addressed in Hugging Face Transformers version 4.36 and later. The security patch (commit 1d63b0ec361e7a38f1339385e8a5a855085532ce) implements a trust verification mechanism that requires explicit user consent via the TRUST_REMOTE_CODE environment variable before allowing pickle.load operations. See the GitHub commit details for the complete fix and the Huntr bounty listing for additional vulnerability information.

Workarounds

  • Avoid loading models from untrusted sources until patching is complete
  • Implement network segmentation to isolate ML pipelines from critical infrastructure
  • Use SafeTensors format instead of pickle-based formats where possible
  • Run model loading operations in sandboxed or containerized environments with restricted permissions
bash
# Upgrade Transformers to patched version
pip install --upgrade transformers>=4.36

# Set environment variable to disable trust for remote code
export TRUST_REMOTE_CODE=False

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

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

  • Vulnerability Details
  • TypeOther

  • Vendor/TechHuggingface Transformers

  • SeverityHIGH

  • CVSS Score8.8

  • EPSS Probability0.18%

  • Known ExploitedNo
  • CVSS Vector
  • CVSS:3.1/AV:N/AC:L/PR:L/UI:N/S:U/C:H/I:H/A:H
  • Impact Assessment
  • ConfidentialityLow
  • IntegrityNone
  • AvailabilityHigh
  • CWE References
  • CWE-502
  • Technical References
  • Huntr Bounty Listing
  • Vendor Resources
  • GitHub Commit Details
  • Related CVEs
  • CVE-2023-7018: Huggingface Transformers Deserialization Flaw

  • CVE-2023-2800: Huggingface Transformers File Vulnerability

  • CVE-2025-2099: Huggingface Transformers ReDoS Vulnerability

  • CVE-2024-11392: Huggingface Transformers 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
  • 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