CVE-2026-80047: Hugging Face Transformers Write-Before-Consent RCE via Malicious Model Repositories
Date: 2026-09-05
Tags: model-poisoning, supply-chain
Executive Summary
A newly disclosed vulnerability in Hugging Face Transformers (versions 4.49.0 through 5.8.1) allows malicious AI model repositories to place attacker-controlled Python files on a user's system before the user approves remote code execution, allowing remote Python code to be written to the local Hugging Face module cache without authorization. CERT/CC published the vulnerability record on September 1, 2026. The framework is commonly integrated into developer workstations, research environments, cloud notebooks, and production ML pipelines, exposing a broad range of users to untrusted content from model repositories.
Campaign Summary
| Field | Detail |
|---|---|
| Campaign / Malware | Unknown—Vulnerability Disclosure Only |
| Attribution | Unknown (confidence: none) |
| Target | AI/ML developers using Hugging Face Transformers for custom generation logic |
| Vector | Malicious model repositories on Hugging Face with crafted custom_generate/generate.py payloads |
| Status | active |
| First Observed | 2026-09-01 |
Detailed Findings
The vulnerability allows remote Python files to be written to local disk without user consent when using GenerativePreTrainedModel.load_custom_generate(), with the function fetching and caching a remote module file before performing the required trust_remote_code consent check, inverting the security model enforced by other code-loading paths. Attacker-controlled Python code from custom_generate/generate.py is copied into the user's ~/.cache/huggingface/modules directory even if the user declines the trust prompt; although execution is correctly gated, the file write is not reversible and can persist across sessions, leading to persistent, unauthorized files on disk and stale cache collisions where cached attacker code may later be executed during trusted model loads. Security researcher Prasanna Dabi reported the vulnerability.
MITRE ATT&CK Mapping
| Technique | ID | Context |
|---|---|---|
| Supply Chain Compromise | T1195.001 | Compromised model repositories trigger RCE via trusted ML library loading mechanism |
IOCs
Domains
_No IOCs published; vulnerability is in library code path, not specific attacker payloads_
Full URL Paths
_No IOCs published; vulnerability is in library code path, not specific attacker payloads_
Splunk Format
_No IOCs available for Splunk query_
Package Indicators
pypi:[email protected]
Affected Platforms
PyPI
Hugging Face model hub
Detection Recommendations
Monitor ~/.cache/huggingface/modules for suspicious Python files appearing without user consent prompts. Audit load_custom_generate() calls and validate model sources before loading. Implement integrity checks on custom generation code and restrict trust_remote_code usage to verified sources. Upgrade to patched Transformers versions immediately upon availability.
References
- [CERT/CC] VU#456290 - Hugging Face Transformers library writes remote code to disk prior to consent check (2026-09-01) — https://kb.cert.org/vuls/id/456290
- [CyberSecurityNews] Hugging Face Flaw Lets Malicious AI Models Plant Python Code on User Systems (2026-09-02) — https://cybersecuritynews.com/hugging-face-flaw/
- [GB Hackers] Hugging Face Transformers Flaw Writes Malicious Python Code to Disk Before User Consent (2026-09-02) — https://gbhackers.com/hugging-face-transformers-flaw/