Skip to main content

Hugging Face Transformers CVE-2026-5241

| EUVDEUVD-2026-34084 CRITICAL
Inclusion of Functionality from Untrusted Control Sphere (CWE-829)
2026-06-03 security@huntr.dev GHSA-fgcw-684q-jj6r
9.6
CVSS 3.1 · NVD
View

Attack ChainAIDerived

Hypothetical attack flow derived from CVE metadata – not a confirmed exploit chain

  1. Recon
    Publish malicious LightGlue model repo
  2. Delivery
    Embed trust_remote_code=true in config.json
  3. Exploit
    Victim calls AutoModel.from_pretrained with trust_remote_code=False
  4. Install
    LightGlueConfig overrides flag from config
  5. C2
    Nested AutoConfig loads attacker Python module
  6. Execute
    Arbitrary code executes in victim process
  7. Impact
    Credential theft and lateral movement

Vulnerability Assessment

Weakness
CWE
OWASP Top 10:2025
A08:2025 - Software or Data Integrity Failures
ASVS 5.0
V15 - Secure Coding and Architecture Trusted source inclusion only
Exploitation Conditions

Victim must invoke AutoModel.from_pretrained() (or an equivalent loader) against an attacker-controlled or compromised model repository that advertises itself as a LightGlue keypoint-matching model and ships a config.json with trust_remote_code embedded as a serialized field. Exploitation specifically requires (a) Transformers version in the vulnerable range (5.2.0 per NVD CPE, <5.5.0 per EUVD), (b) the LightGlue code path - other model architectures are not affected by this particular bypass, and (c) UI:R per CVSS, meaning a human or automated job must initiate the load; the attacker does not need credentials or network position on the victim host. The bypass works even when the user explicitly passes trust_remote_code=False, which removes the most obvious limiting factor users would otherwise rely on. Exploitation is NOT possible against pipelines that only load fully vetted, locally hosted models or that pin to known-safe commit SHAs of trusted publishers.

Impact

Signals are mixed and need to be weighed together. CVSS 9.6 is justified by network attack vector, low complexity, no privileges, scope change (the user process is the only confused deputy and gets fully compromised), and high impact on C/I/A - UI:R reflects that a user must initiate the model load. SSVC marks technical impact as total but automatable as no and exploitation as PoC, which aligns with the Huntr bounty disclosure containing a working proof of concept. EPSS at 0.07% (22th percentile) is low, indicating no observed mass exploitation, and the CVE is NOT on CISA KEV. The realistic risk is high for any environment that loads third-party models from the Hub (research notebooks, inference servers, MLOps pipelines) because users were relying on trust_remote_code=False as a hard guarantee that this CVE proves untrustworthy; conversely, environments restricted to vetted internal models face limited exposure. Note that the NVD CPE only lists 5.2.0 while the EUVD says <5.5.0 - defenders should treat the broader EUVD range as authoritative until vendor confirms.

Exploit ScenarioDerived

An attacker publishes (or compromises) a LightGlue-compatible model repository on the Hugging Face Hub whose config.json sets trust_remote_code: true and references a malicious custom keypoint-detector module. A data scientist or CI/CD pipeline running Transformers 5.2.0 loads the model with AutoModel.from_pretrained('attacker/lightglue-model', trust_remote_code=False), believing they are safe; LightGlueConfig overwrites the runtime flag from the config and Python in the attacker's module executes inside the victim process, enabling credential theft from environment variables, exfiltration of training data, or installation of a persistent backdoor. A proof of concept exists in the Huntr submission.

Act Now Prioritize within 24-48h. Why: CRITICAL severity.
Patch available 0.1% exploitation probability (EPSS)

Get an e-mail when this CVE is exploited, patched or re-scored. Free account.

Alert me

AnalysisAIv3 – Jun 04, 2026

Remote code execution in Hugging Face Transformers 5.2.0 allows a malicious model repository to bypass the user's explicit trust_remote_code=False safeguard when loading a LightGlue model via AutoModel.from_pretrained(). The LightGlueConfig deserializes the trust_remote_code flag from the untrusted config.json and propagates the attacker-controlled value into a nested AutoConfig.from_pretrained() call, enabling execution of arbitrary attacker-supplied Python during model initialization. Rated CVSS 9.6 (AV:N/AC:L/PR:N/UI:R) with publicly available exploit code exists via the Huntr disclosure, though EPSS is currently 0.07% (22th percentile) and the CVE is not on CISA KEV.

Earlier versions of this analysis (2)
v2 Jun 04, 2026 - 19:13 cvss changed CVSS 9.6

Remote code execution in Hugging Face Transformers 5.2.0 (and earlier, fixed in 5.5.0) allows an attacker-controlled model repository to bypass the user's explicit trust_remote_code=False safeguard when loading a LightGlue keypoint-matching model via AutoModel.from_pretrained(). Because LightGlueConfig reads the trust_remote_code value out of the untrusted config.json and forwards it into a nested AutoConfig.from_pretrained() call for the keypoint detector, a malicious model can force loading of attacker-supplied Python modules during initialization. No public exploit is identified at time of analysis, EPSS is low (0.07%, 22nd percentile), and SSVC marks exploitation as POC with total technical impact but not automatable.

v1 Jun 03, 2026 - 14:30 CVSS 8.0

Arbitrary code execution in Hugging Face Transformers 5.2.0 occurs when loading a LightGlue model via AutoModel.from_pretrained() with trust_remote_code=False, because LightGlueConfig honors a trust_remote_code field read from the untrusted config.json and propagates it into nested AutoConfig.from_pretrained() calls. An attacker who controls a model repository can override the victim's explicit safety choice and execute arbitrary Python during model initialization. No public exploit identified at time of analysis, but a vendor commit and huntr bounty disclosure confirm the root cause.

RemediationAI

Vendor-released patch: upgrade huggingface/transformers to 5.5.0 or later, which removes the trust_remote_code attribute from LightGlueConfig and eliminates the nested AutoConfig.from_pretrained() call that consumed it (commit 676559d5022b74aaa0cee1cee0842b7f27c5320e). If immediate upgrade is not possible, restrict LightGlue model loading to repositories you control or have audited - specifically inspect each model's config.json for an injected trust_remote_code key before calling from_pretrained, and prefer pinning to a known-good revision SHA rather than a tag. As a stronger compensating control, run model-loading workers under a non-privileged user inside a sandbox (gVisor, Firecracker, or a container without outbound network) so that arbitrary Python execution cannot reach credentials or perform lateral movement; the trade-off is added operational complexity and potential breakage of legitimate models that need network access at load. Refer to the Huntr advisory at https://huntr.com/bounties/ceb3ce1a-4c45-497a-b25e-cb9a7685e619 for full disclosure details.

Affected VersionsENISA

huggingface/transformers unspecified <5.5.0

Affected Packages

pypi transformers fix: 5.5.0
euvd huggingface_transformers_unspecified fix: 5.5.0

Source: OSV (Open Source Vulnerabilities)

Affects your stack

Affects 2 packages in pypi, euvd

Checking this CVE against your own stacks and servers is part of the Basic plan and up.

Technical ContextAI · show details

Hugging Face Transformers is the de facto Python library for loading and running pretrained ML models from the Hugging Face Hub. The trust_remote_code parameter is a critical security control that gates whether custom Python modules shipped alongside a model are imported and executed at load time; setting it to False is the documented way to refuse arbitrary code from a model repo. The root cause maps to CWE-829 (Inclusion of Functionality from Untrusted Control Sphere): LightGlueConfig defined trust_remote_code as a serialized config field with default False, so an attacker who controls config.json could override the user's runtime choice. The diff (commit 676559d) removes the trust_remote_code attribute from LightGlueConfig entirely, drops the dynamic AutoConfig.from_pretrained() branch for unknown keypoint detectors, and adds a new mlinter rule (TRF014) banning trust_remote_code inside native model integrations going forward. Affected CPE is cpe:2.3:a:huggingface:transformers:5.2.0; per the ENISA EUVD record the issue extends to all versions below 5.5.0.

Know when Hugging Face gets its next vulnerability

  • Watch products and get an email when something new is published
  • Check this CVE against your own stack and servers
  • Exploit and PoC references, threat intelligence from 22 sources

No credit card · 7-day full trial

Severity by source

NVD PRIMARY 9.6 CRITICAL
AV:N/AC:L/PR:N/UI:R/S:C/C:H/I:H/A:H
Red Hat 7.7 HIGH

Primary rating from NVD.

CVSS VectorNVD

Attack Vector
Network
Attack Complexity
Low
Privileges Required
None
User Interaction
Required
Scope
Changed
Confidentiality
High
Integrity
High
Availability
High

Lifecycle Timeline

3
Severity Changed
Jun 04, 2026 - 19:07 NVD
HIGH CRITICAL
CVSS changed
Jun 04, 2026 - 19:07 NVD
8.0 (HIGH) 9.6 (CRITICAL)
Patch available
Jun 03, 2026 - 16:01 EUVD

DescriptionNVD

A vulnerability in the LightGlue model loading path of huggingface/transformers version 5.2.0 allows an attacker-controlled model repository to execute arbitrary code during model initialization. The issue arises because the trust_remote_code parameter, intended to prevent remote code execution, is overridden by untrusted serialized configuration data in a nested code path. Specifically, when loading a LightGlue model using AutoModel.from_pretrained() with trust_remote_code=False, the LightGlueConfig reads the trust_remote_code value from the untrusted config.json file and propagates it into nested AutoConfig.from_pretrained() calls. This results in the execution of attacker-provided Python modules, even when the victim explicitly disables remote code execution. The vulnerability poses a high risk for environments such as API inference servers, research notebooks, CI/CD pipelines, and model evaluation workers, potentially leading to credential theft, lateral movement, or persistence/backdoor deployment.

Blast Radius

ecosystem impact
† from your stack dependencies † transitive graph · vuln.today resolves 4-path depth
  • 33 pypi packages depend on transformers (21 direct, 13 indirect)

Ecosystem-wide dependent count for version 5.2.0.

Executive ViewAI

Why It Matters

Hugging Face Transformers 5.2.0 contains a critical remote code execution vulnerability in LightGlue model loading; publicly available exploit code exists, enabling unauthenticated attackers to execute arbitrary code when users load malicious model repositories. Any organization using Transformers for model inference faces immediate risk to development and production AI infrastructure.

Business Impact: High
Compensating Controls

Apply vendor patch.

Threat Intelligence Overview

EPSS Score
0.1%
Top 78% exploitable
Threat Intel
1
1 source
Social Media
1
Sightings
Data Quality
8 sources
Confidence: High
EUVD NVD CVE.org EPSS Vulnrichment GHSA Vendor CIRCL GitHub VulDB

How this decision was reached

The engine reads each signal below and applies a fixed list of rules from top to bottom. The first rule that matches sets the recommended action – like a statement, every line is shown.

SignalValue
Severity CRITICAL
CISA KEV No
Public POC No
EPSS 0.1%
Patch available Yes
Active threat No
Deciding rule
CRITICAL severity
What every action level means
Emergency Immediate action required. Criteria: CRITICAL + in CISA KEV (actively exploited) without patch, OR CRITICAL + EPSS > 30% without patch, OR CRITICAL + active threat signals without patch.
Act Now Prioritize within 24-48h. Criteria: in KEV with patch available, OR CRITICAL + public POC, OR HIGH + EPSS > 10%, OR CRITICAL + active threat, OR any CRITICAL severity.
This Week Schedule remediation this week. Criteria: HIGH severity (CVSS 7.0-8.9). Patch within normal change window.
This Month Plan within 30 days. Criteria: MEDIUM severity (CVSS 4.0-6.9), lower exploitation probability. Include in regular patch cycle.
Monitor Track and reassess. Criteria: LOW severity (CVSS 0.1-3.9), minimal exploitation risk. No immediate action needed.

SSVC AssessmentENISA

SSVC Decision
Scheduled
Exploitation
Poc
System Exposure· derived
Open
Automatable
No
Human Impact
High
Technical Impact
Total

Priority Score

48
Low Medium High Critical
KEV: 0
EPSS: 0
CVSS: +48
PoC: 0
Weaponized: 0
Threat intel: 0
Gov advisory: 0

Attack Technique

Remote Code Execution represents the critical moment when an attacker successfully runs arbitrary code on a target system without physical access.

CVE-2024-3568 CRITICAL POC
9.6 Apr 10

The huggingface/transformers library is vulnerable to arbitrary code execution through deserialization of untrusted data

CVE-2026-33625 HIGH POC
8.8 Sep 18

Arbitrary Python code execution in LMDeploy 0.12.1 through 0.12.2 lets an attacker who publishes a malicious model on Hu

CVE-2023-6730 HIGH POC
8.8 Dec 19

Deserialization of Untrusted Data in GitHub repository huggingface/transformers prior to 4.36. Rated high severity (CVSS

CVE-2023-7018 HIGH POC
7.8 Dec 20

Deserialization of Untrusted Data in GitHub repository huggingface/transformers prior to 4.36. Rated high severity (CVSS

CVE-2025-3262 HIGH POC
7.5 Jul 07

A Regular Expression Denial of Service (ReDoS) vulnerability was discovered in the huggingface/transformers repository,

CVE-2025-6921 HIGH POC
7.5 Sep 23

The huggingface/transformers library, versions prior to 4.53.0, is vulnerable to Regular Expression Denial of Service (R

CVE-2026-66007 MEDIUM POC
6.9 Jul 24

Path traversal in Hugging Face Datasets up to 5.0.0 allows attackers to read arbitrary local files when a victim process

CVE-2026-69112 MEDIUM POC
6.9 Aug 10

Path traversal in Hugging Face Accelerate through 1.14.0 exposes two distinct attack outcomes when a user loads a crafte

CVE-2026-63086 MEDIUM POC
6.9 Jul 16

Server-side request forgery in HuggingFace text-generation-inference through version 3.3.7 enables unauthenticated remot

CVE-2025-1194 MEDIUM POC
6.5 Apr 29

A Regular Expression Denial of Service (ReDoS) vulnerability was identified in the huggingface/transformers library, spe

CVE-2025-11844 MEDIUM POC
5.4 Oct 22

XPath injection in Hugging Face Smolagents 1.20.0 lets an attacker who can influence the text passed to the vision web b

CVE-2026-25874 CRITICAL
9.3 Apr 23

Unauthenticated remote code execution in HuggingFace LeRobot (versions 0 through 0.5.1) stems from pickle.loads() being

Vendor StatusVendor

This site uses cookies essential for authentication and security. No tracking or analytics cookies are used. Privacy Policy