CVE-2026-80047: Transformers: remote file write bypasses trust prompt
GHSA-x9r9-c232-4q39HIGHPoC AVAILABLEHugging Face Transformers' load_custom_generate() fetches and writes an attacker-controlled Python module to disk (~/.cache/huggingface/modules) before it ever checks trust_remote_code consent, inverting the trust model that AutoConfig, AutoModel and AutoTokenizer correctly enforce. This matters because trust_remote_code is the industry-standard safeguard teams rely on to gate arbitrary code execution when loading community models, and here declining the prompt does nothing — the malicious file is already persisted and can collide with a later, genuinely trusted load. There is no CVSS score, no CISA KEV listing, no EPSS data and no public exploit or scanner template yet, so this is not an actively-weaponized flaw today, but Transformers underpins a huge share of the open-source AI/ML supply chain, which raises the blast radius if this pattern is copied elsewhere. Upgrade past the affected range (>=4.49.0, <=5.8.1) as soon as a patched release is available, and in the meantime audit ~/.cache/huggingface/modules for unexpected files and treat any presence there from a declined-trust session as a tampering indicator. Avoid calling load_custom_generate() against untrusted or unverified model repositories until patched.
What is the risk?
No CVSS vector, EPSS score, or KEV listing exists yet, and there is no public exploit or Nuclei template, so near-term mass exploitation is unlikely. However, the flaw undermines a foundational security control (trust_remote_code) that the entire Hugging Face ecosystem depends on to gate code execution from untrusted model repositories, which elevates its strategic risk beyond what an unscored CVE would normally suggest. The write-before-consent ordering means the vulnerability is exploitable simply by getting a victim to attempt to load a malicious model — no successful trust-prompt acceptance is required, only a file-system write, with code execution deferred to a later stale-cache collision. Given Transformers' enormous downstream footprint (tracked here as an ai_agent-relevant, high-adoption ML library), even a low-complexity, non-scored flaw like this warrants prioritized patching over routine backlog treatment.
How does the attack unfold?
What systems are affected?
| Package | Ecosystem | Vulnerable Range | Patched |
|---|---|---|---|
| Transformers | pip | >= 4.49.0, <= 5.8.1 | No patch |
Do you use Transformers? You're affected.
How severe is it?
What is the attack surface?
What should I do?
1 stepUpgrade Hugging Face Transformers to a version outside the affected range (>=4.49.0, <=5.8.1) as soon as the fix is available; track the vendor advisory at kb.cert.org/vuls/id/456290 and the GitHub repo for the patched release. Until patched, avoid using load_custom_generate() against any model repository that is not fully trusted and version-pinned. Proactively audit ~/.cache/huggingface/modules on hosts that load community models, and treat any custom_generate module present after a declined trust_remote_code prompt as a compromise indicator requiring manual review and removal. Consider running model-loading workflows in ephemeral, isolated environments (containers with disposable filesystems) so a rejected trust prompt cannot leave a persistent artifact, and add file-integrity monitoring on the Hugging Face module cache directory for CI/build and production inference hosts.
What does CISA's SSVC say?
Source: CISA Vulnrichment (SSVC v2.0). Decision based on the CISA Coordinator decision tree.
How is it classified?
Which compliance frameworks are affected?
This CVE is relevant to:
Frequently Asked Questions
What is CVE-2026-80047?
Hugging Face Transformers' load_custom_generate() fetches and writes an attacker-controlled Python module to disk (~/.cache/huggingface/modules) before it ever checks trust_remote_code consent, inverting the trust model that AutoConfig, AutoModel and AutoTokenizer correctly enforce. This matters because trust_remote_code is the industry-standard safeguard teams rely on to gate arbitrary code execution when loading community models, and here declining the prompt does nothing — the malicious file is already persisted and can collide with a later, genuinely trusted load. There is no CVSS score, no CISA KEV listing, no EPSS data and no public exploit or scanner template yet, so this is not an actively-weaponized flaw today, but Transformers underpins a huge share of the open-source AI/ML supply chain, which raises the blast radius if this pattern is copied elsewhere. Upgrade past the affected range (>=4.49.0, <=5.8.1) as soon as a patched release is available, and in the meantime audit ~/.cache/huggingface/modules for unexpected files and treat any presence there from a declined-trust session as a tampering indicator. Avoid calling load_custom_generate() against untrusted or unverified model repositories until patched.
Is CVE-2026-80047 actively exploited?
Proof-of-concept exploit code is publicly available for CVE-2026-80047, increasing the risk of exploitation.
How to fix CVE-2026-80047?
Upgrade Hugging Face Transformers to a version outside the affected range (>=4.49.0, <=5.8.1) as soon as the fix is available; track the vendor advisory at kb.cert.org/vuls/id/456290 and the GitHub repo for the patched release. Until patched, avoid using load_custom_generate() against any model repository that is not fully trusted and version-pinned. Proactively audit ~/.cache/huggingface/modules on hosts that load community models, and treat any custom_generate module present after a declined trust_remote_code prompt as a compromise indicator requiring manual review and removal. Consider running model-loading workflows in ephemeral, isolated environments (containers with disposable filesystems) so a rejected trust prompt cannot leave a persistent artifact, and add file-integrity monitoring on the Hugging Face module cache directory for CI/build and production inference hosts.
What systems are affected by CVE-2026-80047?
This vulnerability affects the following AI/ML architecture patterns: model serving, agent frameworks, RAG pipelines.
What is the CVSS score for CVE-2026-80047?
CVE-2026-80047 has a CVSS v3.1 base score of 7.8 (HIGH). The EPSS exploitation probability is 0.10%.
What is the AI security impact?
Affected AI Architectures
MITRE ATLAS Techniques
AML.T0010.001AI SoftwareAML.T0011.000Unsafe AI ArtifactsAML.T0058Publish Poisoned ModelsCompliance Controls Affected
What are the technical details?
Original Advisory
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.
Exploitation Scenario
An adversary publishes a model repository on the Hugging Face Hub containing a malicious custom_generate/generate.py designed to execute arbitrary code when loaded. A victim, evaluating or integrating the model into an agent or serving pipeline, calls load_custom_generate() — Transformers fetches and writes the remote module to ~/.cache/huggingface/modules before showing the trust_remote_code consent prompt. The victim declines the prompt, believing no code or data was persisted, but the malicious file remains cached indefinitely. Later, the victim (or a teammate on the same host) loads a different, legitimately trusted model that happens to reference a module with a colliding cache path, and the previously-declined attacker code executes silently under the trusted context.
Weaknesses (CWE)
CWE-273 — Improper Check for Dropped Privileges: The product attempts to drop privileges but does not check or incorrectly checks to see if the drop succeeded.
- [Architecture and Design] Compartmentalize the system to have "safe" areas where trust boundaries can be unambiguously drawn. Do not allow sensitive data to go outside of the trust boundary and always be careful when interfacing with a compartment outside of the safe area. Ensure that appropriate compartmentalization is built into the system design, and the compartmentalization allows for and reinforces privilege separation functionality. Architects and designers should rely on the principle of least privilege to decide the appropriate time to use privileges and the time to drop privileges.
- [Implementation] Check the results of all functions that return a value and verify that the value is expected.
Source: MITRE CWE corpus.
CVSS Vector
CVSS:3.1/AV:L/AC:L/PR:L/UI:N/S:U/C:H/I:H/A:HReferences
Timeline
Related Vulnerabilities
CVE-2026-471179.8OpenMed: RCE via trust_remote_code model loading
Same package: transformersCVE-2026-262109.8KTransformers: pickle RCE via unauthenticated ZMQ socket
Same package: transformersCVE-2026-637679.8ktransformers: unauth pickle RCE via ZMQ socket
Same package: transformersCVE-2024-35689.6HuggingFace Transformers: RCE via pickle deserialization
Same package: transformersCVE-2026-52419.6transformers: trust_remote_code bypass enables RCE via model load
Same package: transformers