CVE-2026-80047: CWE-273 Improper Check for Dropped Privileges in Hugging Face Transformers
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.
CVSS v3.1
Score 7.8high
Affected software
Hugging Face
Transformers
AI-Powered Analysis
Machine-generated threat intelligence
Technical Analysis
The vulnerability in Hugging Face Transformers (>=4.57.0 <=5.16.1) involves improper privilege checking (CWE-273) in the load_custom_generate() function of GenerativePreTrainedModel. The function fetches and caches remote Python code before performing the required trust_remote_code consent check, inverting the intended security model used by other code-loading paths. As a result, attacker-controlled Python code is written unconditionally to the user's ~/.cache/huggingface/modules directory even if the user declines the trust prompt. While execution of this code is prevented without user consent, the presence of these files can lead to persistent unauthorized files and stale cache collisions that may later execute during trusted model loads. The root cause is an unconditional file write in dynamic_module_utils.py prior to trust verification.
Potential Impact
An attacker can cause remote Python files to be written to the victim's local disk without consent, leading to persistent unauthorized files in the cache directory. Although immediate execution of attacker code is blocked by the trust prompt, the stale cached files may be executed later during trusted model loads, potentially leading to code execution, data compromise, or denial of service. The vulnerability affects confidentiality, integrity, and availability as indicated by the CVSS vector (C:H/I:H/A:H).
Mitigation Recommendations
Patch status is not yet confirmed — check the vendor advisory for current remediation guidance. Until a fix is available, users should avoid using the load_custom_generate() function with untrusted remote code. Monitor vendor advisories for updates and apply official patches once released.
Technical Details
- Data Version
- 5.2
- Assigner Short Name
- certcc
- Date Reserved
- 2026-08-25T17:29:08.429Z
- State
- PUBLISHED
- Vendor Advisory Urls
- [{"url":"https://kb.cert.org/vuls/id/456290","vendor":"CERT"}]
Threat ID: 6a96d8afacd9273b49c6bf3c
Added to database: 09/01/2026, 13:52:47 UTC
Last enriched: 09/24/2026, 03:40:41 UTC
Last updated: 10/16/2026, 06:48:19 UTC
Views: 141
Community Reviews
0 reviewsCrowdsource mitigation strategies, share intel context, and vote on the most helpful responses. Sign in to add your voice and help keep defenders ahead.
Want to contribute mitigation steps or threat intel context? Sign in or create an account to join the community discussion.
Actions
Updates to AI analysis require Pro Console access. Upgrade inside Console → Billing.
Need more coverage?
Upgrade to Pro Console for AI refresh and higher limits.
For incident response and remediation, OffSeq services can help resolve threats faster.
Latest Threats
Check if your credentials are on the dark web
Instant breach scanning across billions of leaked records. Free tier available.