CVE-2026-80047
Received Received - Intake

Remote Python File Write in Hugging Face Transformers

Vulnerability report for CVE-2026-80047, including description, CVSS score, EPSS score, affected products, exploitability, helpful resources, and attack-flow context.

Publication date: 2026-09-01

Last updated on: 2026-09-01

Assigner: CERT/CC

Description

A vulnerability in Hugging Face Transformers (versions 4.49.0, <= 5.8.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.

CVSS Scores

EPSS Scores

Probability:
Percentile:

Meta Information

Published
2026-09-01
Last Modified
2026-09-01
Generated
2026-09-01
AI Q&A
2026-09-01
EPSS Evaluated
N/A
NVD
EUVD

Affected Vendors & Products

Showing 2 associated CPEs
Vendor Product Version / Range
hugging_face transformers to 5.8.1 (inc)
huggingface transformers From 4.49.0 (inc) to 5.8.1 (inc)

Helpful Resources

Exploitability

CWE
CWE Icon
KEV
KEV Icon
CWE ID Description
CWE-UNKNOWN

Attack-Flow Graph

AI Quick Actions

Instant insights powered by AI
Executive Summary

This vulnerability in Hugging Face Transformers (versions 4.49.0 to 5.8.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, which inverts the security model used by other code-loading paths.

Detection Guidance

Check the Hugging Face module cache directory for unexpected Python files. Inspect ~/.cache/huggingface/modules for files named custom_generate/generate.py or similar. Use commands like ls -la ~/.cache/huggingface/modules/custom_generate/ to list cached files.

Impact Analysis

An attacker could exploit this by publishing a model repository containing a malicious custom_generate/generate.py file. This file would be written to the cache upon loading the model, even if the user declines the consent prompt. The persistent unauthorized file writes may later be executed if cache paths are reused, potentially enabling unintended code execution.

Mitigation Strategies

Avoid loading untrusted model repositories with load_custom_generate(). Periodically inspect and clear the Hugging Face module cache using rm -rf ~/.cache/huggingface/modules/. Ensure trust_remote_code checks are enforced before any remote content retrieval or file writes.

Chat Assistant

Ask questions about this CVE
Hi! I’m here to help you understand CVE-2026-80047. Ask me anything about the vulnerability, its impact, or mitigation strategies.
0/70

EPSS Chart