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-7018

CVE-2023-7018: Huggingface Transformers Deserialization Flaw

CVE-2023-7018 is a deserialization of untrusted data vulnerability in Huggingface Transformers library affecting versions prior to 4.36. This article covers the technical details, affected versions, and mitigation.

Published: February 4, 2026

CVE-2023-7018 Overview

CVE-2023-7018 is an insecure deserialization vulnerability affecting the Huggingface Transformers library prior to version 4.36. The vulnerability exists in the handling of untrusted data through Python's pickle.load functionality, which can be exploited to execute arbitrary code when processing maliciously crafted model files or data.

Critical Impact

Attackers can achieve arbitrary code execution on systems processing untrusted serialized data through the Huggingface Transformers library, potentially leading to complete system compromise.

Affected Products

  • Huggingface Transformers versions prior to 4.36
  • Systems using transfo_xl tokenization components
  • Systems using RAG (Retrieval-Augmented Generation) retrieval components

Discovery Timeline

  • 2023-12-20 - CVE-2023-7018 published to NVD
  • 2024-11-21 - Last updated in NVD database

Technical Details for CVE-2023-7018

Vulnerability Analysis

This vulnerability is classified as CWE-502 (Deserialization of Untrusted Data). The Huggingface Transformers library uses Python's pickle module to deserialize model data and tokenizer configurations. Prior to version 4.36, the library did not adequately restrict the use of pickle.load when processing data from potentially untrusted sources.

Python's pickle module is inherently insecure when handling untrusted data because it can deserialize arbitrary Python objects, including those that execute code during the deserialization process. An attacker can craft a malicious pickle payload that, when deserialized, executes arbitrary Python code with the privileges of the running process.

The vulnerability specifically affects the tokenization components in transfo_xl (deprecated) and the RAG retrieval module, where pickle-based deserialization is used to load cached data and model configurations.

Root Cause

The root cause stems from the unrestricted use of pickle.load in multiple modules within the Transformers library. The library did not implement proper trust boundaries or security checks before deserializing data that could originate from untrusted sources, such as remotely downloaded model files or user-supplied data.

Attack Vector

The attack requires local access and user interaction. An attacker must convince a user to load or process a maliciously crafted model file, tokenizer configuration, or serialized data through the Transformers library. This could occur through:

  • Distributing malicious pre-trained models on model hubs
  • Compromising existing model repositories
  • Social engineering users to load malicious local files
  • Man-in-the-middle attacks during model downloads
python
# Security patch in tokenization_transfo_xl.py
# Source: https://github.com/huggingface/transformers/commit/1d63b0ec361e7a38f1339385e8a5a855085532ce
     is_torch_available,
     logging,
     requires_backends,
+    strtobool,
     torch_only_method,
 )

The patch introduces the strtobool utility to implement trust validation, requiring explicit TRUST_REMOTE_CODE=True before allowing pickle.load operations.

python
# Security patch in retrieval_rag.py
# Source: https://github.com/huggingface/transformers/commit/1d63b0ec361e7a38f1339385e8a5a855085532ce
 
 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

Detection Methods for CVE-2023-7018

Indicators of Compromise

  • Unexpected process spawning from Python processes running Transformers workloads
  • Unusual network connections initiated during model loading operations
  • Suspicious file system modifications during deserialization operations
  • Anomalous system calls during pickle.load execution

Detection Strategies

  • Monitor for pickle.load calls on files from untrusted sources in Python applications
  • Implement application-level logging for model loading operations
  • Use static analysis tools to identify unsafe pickle deserialization patterns
  • Deploy runtime application self-protection (RASP) to detect deserialization attacks

Monitoring Recommendations

  • Enable verbose logging for Transformers library operations
  • Monitor network traffic for connections to unauthorized model repositories
  • Track file access patterns during model loading and tokenization
  • Implement integrity verification for downloaded model files using cryptographic hashes

How to Mitigate CVE-2023-7018

Immediate Actions Required

  • Upgrade Huggingface Transformers to version 4.36 or later immediately
  • Audit existing deployments for use of deprecated transfo_xl components
  • Review any RAG implementations using the affected retrieval module
  • Verify the integrity and source of all pre-trained models in use

Patch Information

Huggingface has addressed this vulnerability in commit 1d63b0ec361e7a38f1339385e8a5a855085532ce. The fix introduces a trust verification mechanism that disallows pickle.load operations unless the TRUST_REMOTE_CODE environment variable is explicitly set to True. Additional details are available in the Huntr Bug Bounty Report.

Workarounds

  • Only load models from trusted, verified sources until patching is complete
  • Set restrictive permissions on directories containing model files
  • Implement network isolation for systems processing untrusted model data
  • Consider using model formats that don't rely on pickle serialization (e.g., SafeTensors)
bash
# Configuration example - Upgrade to patched version
pip install --upgrade transformers>=4.36

# Verify installed version
pip show transformers | grep Version

# Alternative: Use SafeTensors format for model loading
export HF_HUB_ENABLE_HF_TRANSFER=1
export SAFETENSORS_FAST_GPU=1

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 Score7.8

  • EPSS Probability0.18%

  • Known ExploitedNo
  • CVSS Vector
  • CVSS:3.1/AV:L/AC:L/PR:N/UI:R/S:U/C:H/I:H/A:H
  • Impact Assessment
  • ConfidentialityLow
  • IntegrityHigh
  • AvailabilityHigh
  • CWE References
  • CWE-502
  • Vendor Resources
  • GitHub Commit Update

  • Huntr Bug Bounty Report
  • Related CVEs
  • CVE-2023-6730: 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