Skip to main content
Mallory
HighPublic exploit

RCE in HuggingFace Transformers via malicious config.json _attn_implementation_internal

IdentifiersCVE-2026-4372CWE-502· Deserialization of Untrusted Data

CVE-2026-4372 is a critical remote code execution vulnerability in the HuggingFace Transformers library affecting versions prior to 5.3.0, specifically reported as affecting 4.56.0 through 5.2.x when the optional kernels package is installed. The flaw is triggered during normal model loading via AutoModelForCausalLM.from_pretrained() / from_pretrained() when a malicious model repository contains a crafted config.json with the internal field _attn_implementation_internal set to an attacker-controlled HuggingFace Hub repository ID. Due to improper handling of untrusted configuration data, insufficient sanitization of internal attributes, and unsandboxed loading/execution of downloaded kernel code, Transformers can automatically download, import, and execute attacker-controlled Python code. The issue bypasses the intended trust_remote_code=False protection, making exploitation possible through the standard documented workflow without explicit user consent or visible warning.

Share:
For your environment

Are you exposed to this one?

Mallory correlates every CVE against your assets, your vendors, and active adversary campaigns. Know which vulnerabilities matter for you, not just which ones are loud.

ANALYST BRIEF

Impact, mitigation & remediation

What it means. What to do now. Patch path, mitigations, and the assume-compromise checklist.

Impact

What an attacker gets, and what they’ve been doing with it.

Successful exploitation results in arbitrary Python code execution on the victim host with the privileges of the process loading the model, effectively full OS-level code execution in that security context. Reported impacts include theft of AWS credentials, API tokens, SSH keys, environment variables, and proprietary data; establishment of persistence; lateral movement across connected infrastructure; and compromise of CI/CD or automated model evaluation pipelines. Because exploitation occurs silently during routine model loading and can be delivered through seemingly legitimate HuggingFace Hub models, this creates a significant AI supply-chain compromise risk.

Mitigation

If you can’t patch tonight, do this now.

If immediate patching is not possible, do not load untrusted or externally supplied models from HuggingFace Hub, particularly any repository containing or referencing crafted config.json content or internal fields such as _attn_implementation_internal. Restrict model loading to vetted internal repositories, isolate model execution in hardened sandboxes or containers with minimal privileges, prevent access to sensitive credentials from model-loading environments, monitor for unexpected outbound network access during model initialization, and treat model loading as a code-execution surface until all affected systems are upgraded.

Remediation

Patch, then assume compromise.

Upgrade HuggingFace Transformers to version 5.3.0 or later. The reported fix blocks unsafe internal attributes during configuration parsing, enforces stricter controls on kernel loading, and restores the requirement for explicit user consent before external code execution via trust_remote_code=True. Organizations should also review and revalidate previously downloaded or cached models obtained during the exposure window, especially from untrusted or insufficiently vetted repositories.
PUBLIC EXPLOITS

Exploits

No public exploits tracked yet. Mallory keeps watching.

VALID 0 / 0 TOTALView more in app

No public exploit code observed for this vulnerability.

EXPOSURE SURFACE

Affected products & vendors

Products and vendors Mallory has correlated with this vulnerability. Open in Mallory to drill down to specific CPE configurations and version ranges.

VendorProductType
Hugging FaceTransformersapplication

Vendor-confirmed product mapping. Mallory continuously reconciles this list against your asset inventory.

What this page doesn’t show

The version that knows your environment.

This page is what’s public. Mallory adds the parts that aren’t: which of your assets are affected, which adversaries are exploiting it right now, which detections to deploy, and what to do tonight.
Exposure mapping

Query your assets running an affected version, and investigate the blast radius.

Threat actor evidence

Every observed campaign linking this CVE to a named adversary.

Associated malware

Malware families riding this exploit, with evidence and IOCs.

Detection signatures

YARA, Sigma, Snort, and vendor rules, auto-deployed to your SIEM.

Vendor-by-vendor mapping

Cross-references every affected SKU, including bundled OEM variants.

Social activity7

Community discussion across Reddit, Mastodon, and other social sources.