Skip to main content

HuggingFace Transformers EUVDEUVD-2026-31598

| CVE-2026-4372 HIGH
Missing Serialization Control Element (CWE-1066)
2026-05-24 @huntr_ai GHSA-29pf-2h5f-8g72
7.8
CVSS 3.0 · Vendor: huntr_ai
View

Attack ChainAIDerived

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

  1. Recon
    Publish malicious model to HuggingFace Hub
  2. Delivery
    Embed `_attn_implementation_internal` repo ID in config.json
  3. Exploit
    Victim calls `AutoModelForCausalLM.from_pretrained()`
  4. Install
    Library deserializes internal field via setattr
  5. C2
    Kernel module fetched from attacker repo
  6. Execute
    Python code executes with user privileges
  7. Impact
    Credential theft or lateral movement

Vulnerability Assessment

Weakness
CWE
Exploitation Conditions

Exploitation requires that the victim invoke a from_pretrained()-style loader (e.g., AutoModelForCausalLM.from_pretrained) on a model whose config.json the attacker controls - either by publishing it under an attacker-owned Hugging Face Hub repo and inducing the victim to load that repo ID, or by supplying a malicious config.json via a local model directory. The malicious config must set _attn_implementation_internal (or _experts_implementation_internal) to a Hub repo ID outside the kernels-community namespace. Notably, trust_remote_code=False does NOT prevent exploitation - the kernel-loading path is independent of that flag. Limiting factors: the user must initiate the model load (UI:R in the CVSS), the target host must have outbound network access to huggingface.co to fetch the malicious kernel, and the victim must be running a Transformers version prior to 5.3.0. No authentication on the victim side is required (PR:N).

Impact

Signals conflict and need to be weighed carefully. CVSS is 7.8 with vector AV:L/AC:L/PR:N/UI:R/C:H/I:H/A:H - NVD scored this as Local with required user interaction (loading a model), but in practice the malicious payload is delivered over the network via the Hugging Face Hub, so real-world reach is broader than 'local' suggests. SSVC reports Exploitation: none, Automatable: no, Technical Impact: total, and EPSS is just 0.03% (9th percentile) with no KEV listing and no public exploit identified at time of analysis. That said, the attack abuses the standard, documented from_pretrained() workflow used by virtually every Transformers user, is invisible to the victim, and bypasses the trust_remote_code gate that defenders rely on - so the practical risk for any organization that pulls third-party models from the Hub is substantially higher than the EPSS percentile implies. Treat as high priority for ML/AI engineering environments and CI runners that load untrusted models, lower priority for systems that only load vetted internal models.

Exploit ScenarioDerived

An attacker publishes a benign-looking model to the Hugging Face Hub (or convinces a victim to download a model archive) whose config.json contains "_attn_implementation_internal": "attacker/payload-kernel". When a data scientist or CI pipeline runs AutoModelForCausalLM.from_pretrained("attacker/looks-legit-model") - even with trust_remote_code=False - Transformers silently fetches and executes the attacker's kernel Python module, yielding code execution with the victim user's OS privileges (e.g., access to cloud credentials, training datasets, or lateral movement from a GPU build server). No public exploit code has been identified at time of analysis, but the patch diff makes the exploitation path straightforward to reconstruct.

This Week Schedule remediation this week. Why: HIGH severity (CVSS 7.0-8.9).
Patch available 0.0% exploitation probability (EPSS)

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

Alert me

AnalysisAIv1 – Jun 08, 2026

Remote code execution in HuggingFace Transformers prior to 5.3.0 allows attackers to achieve arbitrary code execution on a victim's machine by publishing a malicious model whose config.json sets the _attn_implementation_internal field to an attacker-controlled Hub repository. When the victim calls the standard AutoModelForCausalLM.from_pretrained() API, the library silently downloads and executes Python kernels from that repository with the victim's privileges, bypassing the trust_remote_code safety gate. No public exploit is identified at time of analysis (EPSS 0.03%, SSVC exploitation: none), but the technical impact is total and the attack uses the documented, default usage pattern.

RemediationAI

Vendor-released patch: upgrade transformers to version 5.3.0 or later (pip install --upgrade 'transformers>=5.3.0'), which both blocks deserialization of _attn_implementation_internal and _experts_implementation_internal from hub configs and restricts kernel loading to the kernels-community namespace (commit a7f8e7ff37d87d1a1a0c8cf607971c607741452f). If immediate upgrade is not possible, compensating controls include pinning model loads to a curated allowlist of known-good repository IDs/revisions and rejecting any config.json whose keys include _attn_implementation_internal or _experts_implementation_internal before passing it to from_pretrained(); running model loading inside a network-egress-restricted sandbox (container with no outbound access to huggingface.co except a proxied mirror, or seccomp/firejail) limits the kernel download step, at the cost of breaking any legitimate dynamic kernel fetching. Note that setting trust_remote_code=False does NOT mitigate this issue because the vulnerability bypasses that mechanism. Vendor and advisory links: https://github.com/huggingface/transformers/commit/a7f8e7ff37d87d1a1a0c8cf607971c607741452f and https://huntr.com/bounties/1f693a6e-6836-4b8b-a0bd-ca036fba8884.

Affected VersionsENISA

huggingface/transformers unspecified <5.3.0

Affected Packages

pypi transformers fix: 5.3.0
euvd huggingface_transformers_unspecified fix: 5.3.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

HuggingFace Transformers is the dominant Python library for loading and running transformer-based ML models, identified by CPE cpe:2.3:a:huggingface:huggingface/transformers. The root cause maps to CWE-1066 (missing serialization control element): the PretrainedConfig.__init__ constructor in src/transformers/configuration_utils.py blindly applied setattr for every key in a user-supplied config.json, including internal-only fields prefixed with underscore such as _attn_implementation_internal and _experts_implementation_internal. Those fields are subsequently consumed by the Hub kernels integration (integrations/hub_kernels.py), which previously accepted any <owner>/<repo> pattern and fetched/executed the referenced kernel module. The combination - unfiltered deserialization of an internal field, plus an unsandboxed kernel-fetch-and-execute path that did not honor trust_remote_code - converts model loading into arbitrary code execution. The fix denylists the two internal fields during deserialization and restricts kernel loading to the trusted kernels-community namespace.

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

Vendor (huntr_ai) PRIMARY 7.8 HIGH
AV:L/AC:L/PR:N/UI:R/S:U/C:H/I:H/A:H

Primary rating from Vendor (huntr_ai) · only source for this CVE.

CVSS VectorVendor: huntr_ai

Attack Vector
Local
Attack Complexity
Low
Privileges Required
None
User Interaction
Required
Scope
Unchanged
Confidentiality
High
Integrity
High
Availability
High

Lifecycle Timeline

1
Patch available
May 26, 2026 - 14:16 EUVD

DescriptionCVE.org

A critical remote code execution vulnerability exists in all versions of the HuggingFace transformers library prior to version 5.3.0. The vulnerability allows an attacker to craft a malicious config.json file containing the _attn_implementation_internal field set to an attacker-controlled HuggingFace Hub repository ID. When a victim loads this model using the standard AutoModelForCausalLM.from_pretrained() API, the library downloads and executes arbitrary Python code from the attacker's repository with the victim's full OS privileges. This issue arises due to unfiltered deserialization of configuration attributes, insufficient sanitization of internal fields, and unsandboxed execution of downloaded kernels. The vulnerability bypasses the trust_remote_code security mechanism, is invisible to the victim, and exploits the standard documented usage pattern, making it particularly severe. Users are advised to upgrade to version 5.3.0 or later to mitigate this issue.

Blast Radius

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

Ecosystem-wide dependent count for version 5.3.0.

Executive ViewAI

Why It Matters

HuggingFace Transformers prior to 5.3.0 enables remote code execution through a supply-chain attack targeting organizations whose ML and data science teams download models from HuggingFace Hub. Attackers can inject arbitrary code execution into development and production servers via malicious models through the library's standard from_pretrained() API. This vulnerability exploits a trusted, well-documented operation pattern that most organizations using HuggingFace consider safe.

Business Impact: High
Compensating Controls

Apply vendor patch.

Threat Intelligence Overview

EPSS Score
0.0%
Top 91% exploitable
Threat Intel
1
1 source
Exploit
POC
Public exploit code exists
Data Quality
6 sources
Confidence: High
EUVD NVD CVE.org EPSS Vulnrichment GHSA GitHub

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 HIGH
CISA KEV No
Public POC Yes
EPSS 0.0%
Patch available Yes
Active threat No
Deciding rule
HIGH severity (CVSS 7.0-8.9)
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
None
System Exposure· derived
Small
Automatable
No
Human Impact
High
Technical Impact
Total

Priority Score

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

Attack Technique

Insecure deserialization occurs when an application converts serialized data (a stream of bytes representing an object's state) back into a living object without proper validation.

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-25874 CRITICAL POC
9.3 Apr 23

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

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-2026-57845 HIGH POC
8.7 Oct 23

Deserialization of attacker-supplied pickle data in the deprecated pandas packaged builder of Hugging Face Datasets (all

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-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-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-2025-1194 MEDIUM POC
6.5 Apr 29

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

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