RCE in Hugging Face Transformers via Malicious Config
Score: 8/10

RCE in Hugging Face Transformers via Malicious Config

A vulnerability in Hugging Face Transformers allows attackers to execute arbitrary Python code via crafted config.json files in model repositories, bypassing the trust_remote_code protection.

Executive Summary

A critical remote code execution (RCE) vulnerability, identified as CVE-2026-4372, has been discovered in the Hugging Face Transformers library affecting versions prior to 5.3.0. The flaw resides in how the library deserializes model configuration files, specifically allowing the `_attn_implementation_internal` field to redirect code execution to an attacker-controlled repository. This bypasses the standard `trust_remote_code=False` security boundary, meaning users can be compromised even when they have explicitly disabled remote code execution.

Technically, the attack chain is triggered when a victim loads a malicious model using standard APIs like `AutoModelForCausalLM.from_pretrained()`. The configuration file influences internal kernel-loading logic, causing the library to download and execute arbitrary Python modules with the privileges of the local process. This highlights a significant shift in AI security, where model repositories must be treated as active software supply-chain inputs rather than passive data files.

The business impact is substantial for organizations utilizing automated AI evaluation pipelines, shared notebook environments, or CI/CD jobs that pull models from public hubs. If compromised, attackers could gain access to cloud credentials, internal datasets, and sensitive API tokens mounted in these environments. Immediate patching to Transformers v5.3.0+ is required, alongside a review of model intake policies.

Key Details

Threat Name

CVE-2026-4372

Affects

Hugging Face Transformers versions before 5.3.0, Transformers 4.56.0 through 5.2.x, PyTorch 2.5.1 and earlier

Adversary

—

MITRE Techniques

Malware/Tools

Open OSS privacy filter loader

Report Score

8out of 10
Quality Score
Good
IOC Quality4
TTP Details9
Detection Guidance9
Enterprise Relevance9
Clarity & Structure10
Technical Depth8

Sources