Junglewise Threat Intelligence

CVE-2026-4372: HuggingFace transformers remote code execution via config.json

CVE-2026-4372 · Severity: high · CVSS 7.8 · Published 2026-05-24

Executive brief

HuggingFace transformers, a widely used library for machine learning and artificial intelligence, is vulnerable to a flaw that allows attackers to execute malicious code on a user's system. By tricking a user into loading a specially crafted model configuration file, an attacker can gain full control over the victim's computer with their existing permissions. This could lead to the theft of sensitive data, installation of malware, or complete system compromise.

Technical details

A remote code execution vulnerability exists in HuggingFace transformers due to insecure deserialization of configuration attributes. An attacker can craft a 'config.json' file where the '_attn_implementation_internal' field points to a malicious HuggingFace Hub repository. When a victim uses the 'AutoModelForCausalLM.from_pretrained()' API to load the model, the library downloads and executes arbitrary Python code from the attacker-controlled repository. This exploit bypasses the 'trust_remote_code' security flag because it leverages internal fields that are not properly sanitized or sandboxed. The issue is addressed in version 5.3.0.

Affected products

  • HuggingFace transformers < 5.3.0

Timeline

  • 2026-05-24: advisory: NVD publication date
  • 2026-05-26: disclosed: GitHub Advisory published
  • 2026-07-01: patched: GitHub Advisory updated and reviewed

References

Related threats