CVE-2026-4372: CWE-1066 Missing Serialization Control Element in huggingface huggingface/transformers
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.
AI Analysis
Technical Summary
This vulnerability (CVE-2026-4372) affects all versions of the HuggingFace transformers library before 5.3.0. It arises from missing serialization control elements (CWE-1066) that allow an attacker to embed a malicious `_attn_implementation_internal` field in a model's config.json. When a victim loads the model using AutoModelForCausalLM.from_pretrained(), the library downloads and executes attacker-controlled Python code from a specified HuggingFace Hub repository with the victim's OS privileges. The flaw bypasses the trust_remote_code security mechanism due to unfiltered deserialization and unsandboxed code execution, making exploitation stealthy and severe. The vulnerability has a CVSS 3.0 score of 7.8 (high severity).
Potential Impact
Successful exploitation results in remote code execution on the victim's system with full operating system privileges. This can lead to complete system compromise, data theft, or further malicious activity. The attack is stealthy and exploits normal documented usage patterns, increasing risk to users of affected versions.
Mitigation Recommendations
Users should upgrade to HuggingFace transformers version 5.3.0 or later, where this vulnerability is fixed. No official patch link was provided, but the vendor advisory clearly states upgrading to 5.3.0+ mitigates the issue. Until upgrading, avoid loading untrusted models or config files. Patch status is confirmed by the vendor advisory recommending version 5.3.0 or later.
CVE-2026-4372: CWE-1066 Missing Serialization Control Element in huggingface huggingface/transformers
Description
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.
CVSS v3.0
Score 7.8high
Affected software
Run on your own infrastructure? Check whether these packages are installed with threat-finder — our free open-source scanner.
Weaknesses
AI-Powered Analysis
Machine-generated threat intelligence
Technical Analysis
This vulnerability (CVE-2026-4372) affects all versions of the HuggingFace transformers library before 5.3.0. It arises from missing serialization control elements (CWE-1066) that allow an attacker to embed a malicious `_attn_implementation_internal` field in a model's config.json. When a victim loads the model using AutoModelForCausalLM.from_pretrained(), the library downloads and executes attacker-controlled Python code from a specified HuggingFace Hub repository with the victim's OS privileges. The flaw bypasses the trust_remote_code security mechanism due to unfiltered deserialization and unsandboxed code execution, making exploitation stealthy and severe. The vulnerability has a CVSS 3.0 score of 7.8 (high severity).
Potential Impact
Successful exploitation results in remote code execution on the victim's system with full operating system privileges. This can lead to complete system compromise, data theft, or further malicious activity. The attack is stealthy and exploits normal documented usage patterns, increasing risk to users of affected versions.
Mitigation Recommendations
Users should upgrade to HuggingFace transformers version 5.3.0 or later, where this vulnerability is fixed. No official patch link was provided, but the vendor advisory clearly states upgrading to 5.3.0+ mitigates the issue. Until upgrading, avoid loading untrusted models or config files. Patch status is confirmed by the vendor advisory recommending version 5.3.0 or later.
Technical Details
- Data Version
- 5.2
- Assigner Short Name
- @huntr_ai
- Date Reserved
- 2026-03-18T10:04:09.683Z
- Cvss Version
- 3.0
- State
- PUBLISHED
- Remediation Level
- null
Threat ID: 6a1304c109f6977edb6ac82b
Added to database: 05/24/2026, 14:01:37 UTC
Last enriched: 05/31/2026, 20:37:35 UTC
Last updated: 07/22/2026, 15:02:56 UTC
Views: 413
Community Reviews
0 reviewsCrowdsource mitigation strategies, share intel context, and vote on the most helpful responses. Sign in to add your voice and help keep defenders ahead.
Want to contribute mitigation steps or threat intel context? Sign in or create an account to join the community discussion.
Actions
Updates to AI analysis require Pro Console access. Upgrade inside Console → Billing.
Need more coverage?
Upgrade to Pro Console for AI refresh and higher limits.
For incident response and remediation, OffSeq services can help resolve threats faster.
Latest Threats
Check if your credentials are on the dark web
Instant breach scanning across billions of leaked records. Free tier available.