CVE-2026-4372: Arbitrary Remote Code Execution via `_attn_implementation_internal` Config Injection in 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 attnimplementationinternal field set to an attacker-controlled HuggingFace Hub repository ID. When a victim loads this model using the standard AutoModelForCausalLM.frompretrained() 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 trustremotecode 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.
Affected Software
Remediation
Recommended actions to resolve this vulnerability, in priority order.
- Upgrade
Upgrade
huggingface/transformersto a version that resolves this vulnerability.Fixed in 5.3.0
Event History
Frequently Asked Questions
What is the severity of CVE-2026-4372?
CVE-2026-4372 has a high severity score of 7.8.
What impact does CVE-2026-4372 have on users?
CVE-2026-4372 allows for arbitrary remote code execution, potentially compromising users' systems.
How do I fix CVE-2026-4372?
To fix CVE-2026-4372, upgrade the HuggingFace transformers library to version 5.3.0 or later.
Which versions are affected by CVE-2026-4372?
All versions of the HuggingFace transformers library prior to version 5.3.0 are affected by CVE-2026-4372.
What type of vulnerability is CVE-2026-4372?
CVE-2026-4372 is classified as a remote code execution vulnerability.