Remote code execution through model configuration in Hugging Face Transformers
CVE-2026-4372 is a remote code execution vulnerability affecting Hugging Face Transformers versions 4.56.0 through 5.2.x when the optional kernels package is installed. Improper filtering of deserialized model configuration attributes allows an attacker to set the internal _attn_implementation_internal field to an attacker-controlled Hugging Face Hub repository identifier. During standard model loading through AutoModelForCausalLM.from_pretrained(), Transformers downloads and executes Python kernel code from that repository without adequate validation or sandboxing. This bypasses the trust_remote_code=False security setting and executes code with the operating system privileges of the model-loading process.
What it means and what to do now: patch path, interim mitigations, and the assume-compromise checklist.
What an attacker gets, and what they’ve been doing with it.
Loading a malicious model can compromise the confidentiality and integrity of the model-loading environment through arbitrary Python execution. Accessible cloud credentials, API tokens, SSH keys, environment variables, and proprietary datasets may be stolen. Attackers may also establish persistence, move laterally, or compromise automated model evaluation and CI/CD pipelines, depending on the privileges and resources available to the affected process. Exploitation can occur without a warning during normal model loading.
If you can’t patch tonight, do this now.
Until upgraded, avoid loading models or repositories that are untrusted or whose configuration integrity cannot be established. Inspect model configurations for unexpected internal attributes, particularly _attn_implementation_internal values referencing external repositories. Isolate model-loading environments, minimize accessible credentials and privileges, and monitor unexpected outbound connections during model initialization. Setting trust_remote_code=False alone does not prevent exploitation.
Patch, then assume compromise.
Upgrade Hugging Face Transformers to version 5.3.0 or later in all affected environments. The fix filters unsafe internal configuration attributes and strengthens kernel-loading controls so that external code execution requires explicit consent through trust_remote_code=True.
1 exploit validated by Mallory's analysis.
Products and vendors Mallory has correlated with this vulnerability. Open in Mallory to drill down to specific CPE configurations and version ranges.
17 sources tracked across advisories, community write-ups, and news. New activity surfaces here as Mallory finds it.