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.
References
| Link | Resource |
|---|---|
| https://github.com/huggingface/transformers/commit/a7f8e7ff37d87d1a1a0c8cf607971c607741452f | Patch |
| https://huntr.com/bounties/1f693a6e-6836-4b8b-a0bd-ca036fba8884 | Exploit Third Party Advisory |
Configurations
History
04 Jun 2026, 18:24
| Type | Values Removed | Values Added |
|---|---|---|
| CPE | cpe:2.3:a:huggingface:transformers:*:*:*:*:*:*:*:* | |
| CWE | CWE-502 | |
| First Time |
Huggingface
Huggingface transformers |
|
| References | () https://github.com/huggingface/transformers/commit/a7f8e7ff37d87d1a1a0c8cf607971c607741452f - Patch | |
| References | () https://huntr.com/bounties/1f693a6e-6836-4b8b-a0bd-ca036fba8884 - Exploit, Third Party Advisory |
24 May 2026, 14:16
| Type | Values Removed | Values Added |
|---|---|---|
| New CVE |
Information
Published : 2026-05-24 14:16
Updated : 2026-06-04 18:24
NVD link : CVE-2026-4372
Mitre link : CVE-2026-4372
CVE.ORG link : CVE-2026-4372
JSON object : View
Products Affected
huggingface
- transformers
