Arbitrary Remote Code Execution via `_attn_implementation_internal` Config Injection in huggingface/transformers (huggingface huggingface/transformers)
At a glance
- Source
- NVD
- EPSS
- EPSS 0.70 % · percentile 53 ()
- State
- PUBLISHED
- Published
- Updated
- Assigner
- @huntr_ai
- NVD status
- Analyzed
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.
Weaknesses (CWE)
References
Scores
| Version | Score | Vector | Scored by |
|---|---|---|---|
| CVSS 3.0 | HIGH 7.8 | CVSS:3.0/AV:L/AC:L/PR:N/UI:R/S:U/C:H/I:H/A:H | @huntr_ai |
| CVSS 3.0 | HIGH 7.8 | CVSS:3.0/AV:L/AC:L/PR:N/UI:R/S:U/C:H/I:H/A:H | NVD · security@huntr.dev (Secondary) |
Advisories
- GHSA-29pf-2h5f-8g72 — HuggingFace transformers vulnerable to remote code execution
- PYSEC-2026-2289 — A critical remote code execution vulnerability exists in all versions of the HuggingFace transformers library prior to version 5.3.0. The vulnerability allows a
European references
- ENISA EUVD · EUVD-2026-31598
- GCVE · GCVE-0-2026-4372
Affected configurations (NVD CPE)
cpe:2.3:a:huggingface:transformers:*:*:*:*:*:*:*:*< 5.3.0
Affected products
| Product | Versions |
|---|---|
| huggingface · huggingface/transformers | affected unspecified < 5.3.0 |
Sources
| Source | Licence |
|---|---|
| CVE List (CVEProject cvelistV5) | CVE Program Terms of Use |
| EPSS (FIRST.org) | FIRST — attribution requested |
| ENISA EUVD | ENISA — reproduction authorised, source acknowledged |
| NVD (NIST) via fkie-cad/nvd-json-data-feeds | Public domain — this product uses data from the NVD API but is not endorsed or certified by the NVD |