Skip to content
TransformersGHSA-29pf-2h5f-8g72

HuggingFace transformers vulnerable to remote code execution

High7.8CVE-2026-4372 · Published May 26, 2026 · updated Sep 10, 2026

GitHub advisory

Affected versions

PackageAffectedFixed in
transformers
PyPI
< 5.3.05.3.0
Details and references

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 3.0
CVSS:3.0/AV:L/AC:L/PR:N/UI:R/S:U/C:H/I:H/A:H
Severity from
GitHub (reviewed advisory)
Weakness
CWE-1066, CWE-502
Also known as
CVE-2026-4372, PYSEC-2026-2289

More Transformers advisories

All Transformers
DateAdvisory
Jun 3huggingface/transformers: Arbitrary Code Execution During Model Initialization in the LightGlue Model Loading Path
CVE-2026-5241High8.0fixed in 5.5.0
Apr 7HuggingFace Transformers allows for arbitrary code execution in the `Trainer` class
CVE-2026-1839Medium6.5fixed in 5.0.0rc3
Aug 2Transformers save_pretrained path traversal allows arbitrary file writes through chat template names
CVE-2026-9856High7.1fixed in 5.10.0
Dec 232025Hugging Face Transformers HuBERT convert_config Code Injection Remote Code Execution Vulnerability. This vulnerability allows remote attackers to execute arbitrary code on affected installations of Hugging Face Transformers. User interaction is required to exploit this vulnerability in that the targ
CVE-2025-14928High7.8no fix yet
Dec 232025Hugging Face Transformers X-CLIP Checkpoint Conversion Deserialization of Untrusted Data Remote Code Execution Vulnerability. This vulnerability allows remote attackers to execute arbitrary code on affected installations of Hugging Face Transformers. User interaction is required to exploit this vuln
CVE-2025-14929High7.8no fix yet
Dec 232025Hugging Face Transformers GLM4 Deserialization of Untrusted Data Remote Code Execution Vulnerability. This vulnerability allows remote attackers to execute arbitrary code on affected installations of Hugging Face Transformers. User interaction is required to exploit this vulnerability in that the ta
CVE-2025-14930High7.8no fix yet

Critical advisories by email

Wednesdays: the week’s critical and high advisories in the AI and data stack, with the fixed versions. Only in weeks that have some.

Double opt-in. Unsubscribe any time.