Arbitrary Remote Code Execution via `_attn_implementation_internal` Config Injection in huggingface/transformers (huggingface huggingface/transformers)

CVE-2026-4372
HIGH 7.8

At a glance

Source
NVD
EPSS
EPSS 0.70 % · percentile 53 ()
State
PUBLISHED
Published
Updated
Assigner
@huntr_ai
NVD status
Analyzed

Description

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.

Weaknesses (CWE)

  • CWE-1066 — Missing Serialization Control Element
  • CWE-502 — Deserialization of Untrusted Data

References

Scores

VersionScoreVectorScored by
CVSS 3.0HIGH 7.8CVSS:3.0/AV:L/AC:L/PR:N/UI:R/S:U/C:H/I:H/A:H@huntr_ai
CVSS 3.0HIGH 7.8CVSS:3.0/AV:L/AC:L/PR:N/UI:R/S:U/C:H/I:H/A:HNVD · security@huntr.dev (Secondary)

Advisories

European references

Affected configurations (NVD CPE)

Affected products

ProductVersions
huggingface · huggingface/transformersaffected unspecified < 5.3.0

Sources

SourceLicence
CVE List (CVEProject cvelistV5)CVE Program Terms of Use
EPSS (FIRST.org)FIRST — attribution requested
ENISA EUVDENISA — reproduction authorised, source acknowledged
NVD (NIST) via fkie-cad/nvd-json-data-feedsPublic domain — this product uses data from the NVD API but is not endorsed or certified by the NVD