CVE-2026-80047 Hugging Face Transformers library writes remote code to disk prior to consent check
Attackers can write malicious Python files to disk before consent checks, potentially leading to persistent unauthorized files and future code execution.
- Exploited in the wild
- Not known
- Login needed
- Any signed-in user
- Attackable
- Local or same network only
- Victim action needed
- Not needed
- Fix
- Available
What is CVE-2026-80047?
CVE-2026-80047 is a high-severity path traversal vulnerability in Hugging Face Transformers, published on 1 Sep 2026. It can only be exploited from the same machine or local network, with no action from the victim.
Official description
A vulnerability in Hugging Face Transformers (versions 4.57.0 to 5.16.1) allows remote Python files to be written to local disk without user consent when using GenerativePreTrainedModel.load_custom_generate(). The function fetches and caches a remote module file before performing the required trust_remote_code consent check, inverting the security model enforced by other code-loading paths (such as AutoConfig, AutoModel, and AutoTokenizer). As a result, 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. This can lead to persistent, unauthorized files on disk and stale cache collisions where cached attacker code may later be executed during trusted model loads. The issue stems from an unconditional file write in dynamic_module_utils.py prior to any trust verification.
Which versions are affected by CVE-2026-80047?
3 open source packages ship an affected version, including transformers.
| Package | Affected | Fixed in |
|---|---|---|
transformers PyPI | From 4.49.0 to 5.8.1 | None |
transformers PyPI | From 4.49.0 to 5.8.1 | None |
transformers PyPI | From 4.49.0 to 5.8.1 | None |
How do I fix CVE-2026-80047?
Apply the vendor's patch.
Upgrade, and resolve every user-supplied path against an allowed base folder before opening it. More about Path traversal.
Is CVE-2026-80047 being exploited?
There is no known exploitation of CVE-2026-80047 in the wild and no public exploit code.
Sources
Also known as CLSA-2026-1790831175, ECHO-604e-0a83-9b07, GHSA-x9r9-c232-4q39, MINI-433r-h2fr-55qr, MINI-h9gm-47rv-25hg, MINI-rf48-896p-j5f2 and 1 more.