Hugging Face Transformers library writes remote code to disk prior to consent check

Summary

CVECVE-2026-80047
StatePUBLISHED
Assignercertcc
Source PriorityCVE Program / NVD first with legacy fallback
Published2026-09-01 14:17:41 UTC
Updated2026-09-03 17:53:32 UTC
DescriptionA vulnerability in Hugging Face Transformers (versions >= 4.49.0 and <= 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.

Risk And Classification

Primary CVSS: v3.1 7.8 HIGH from ADP

CVSS:3.1/AV:L/AC:L/PR:L/UI:N/S:U/C:H/I:H/A:H

EPSS: 0.000820000 probability, percentile 0.002330000 (date 2026-09-04)

Problem Types: CWE-273 | CWE-367 | CWE-494 | CWE-273 Improper Check for Dropped Privileges | CWE-367 Time-of-Check Time-of-Use (TOCTOU Race Condition) | CWE-494 Download of Code Without Integrity Check | CWE-273 CWE-273 Improper Check for Dropped Privileges | CWE-367 CWE-367 Time-of-check Time-of-use (TOCTOU) Race Condition | CWE-494 CWE-494 Download of Code Without Integrity Check


VersionSourceTypeScoreSeverityVector
3.1ADPDECLARED7.8HIGHCVSS:3.1/AV:L/AC:L/PR:L/UI:N/S:U/C:H/I:H/A:H
3.1134c704f-9b21-4f2e-91b3-4a467353bcc0Secondary7.8HIGHCVSS:3.1/AV:L/AC:L/PR:L/UI:N/S:U/C:H/I:H/A:H

CVSS v3.1 Breakdown

Attack Vector
Local
Attack Complexity
Low
Privileges Required
Low
User Interaction
None
Scope
Unchanged
Confidentiality
High
Integrity
High
Availability
High

CVSS:3.1/AV:L/AC:L/PR:L/UI:N/S:U/C:H/I:H/A:H

Vendor Declared Affected Products

SourceVendorProductVersionPlatforms
CNA Hugging Face Transformers affected 4.49.0 5.8.1 custom Not specified

References

ReferenceSourceLinkTags
kb.cert.org/vuls/id/456290 [email protected] kb.cert.org
www.kb.cert.org/vuls/id/456290 af854a3a-2127-422b-91ae-364da2661108 www.kb.cert.org
github.com/huggingface/transformers [email protected] github.com
CVE Program record CVE.ORG www.cve.org canonical
NVD vulnerability detail NVD nvd.nist.gov canonical, analysis

© CVE.report 2026

Use of this information constitutes acceptance for use in an AS IS condition. There are NO warranties, implied or otherwise, with regard to this information or its use. Any use of this information is at the user's risk. It is the responsibility of user to evaluate the accuracy, completeness or usefulness of any information, opinion, advice or other content. EACH USER WILL BE SOLELY RESPONSIBLE FOR ANY consequences of his or her direct or indirect use of this web site. ALL WARRANTIES OF ANY KIND ARE EXPRESSLY DISCLAIMED. This site will NOT BE LIABLE FOR ANY DIRECT, INDIRECT or any other kind of loss.

CVE, CWE, and OVAL are registred trademarks of The MITRE Corporation and the authoritative source of CVE content is MITRE's CVE web site. This site includes MITRE data granted under the following license.

Free CVE JSON API cve.report/api

CVE.report and Source URL Uptime Status status.cve.report