Hugging Face Transformers downloads custom generation code before trust consent
What fixes it
No source in this snapshot names a fixed version. The vendor advisories under References are the place to check.
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.
Text from CVE List
Affected versions 53
- transformers, pip>= 4.49.0, <= 5.8.1GitHub
- Transformersaffected: 4.57.0 through 5.16.1CVE List
- transformers, PyPIfrom 4.49.0, through 5.8.1OSV
- transformers, PyPI4.49.0OSV
- transformers, PyPI4.50.0OSV
- transformers, PyPI4.50.1OSV
- transformers, PyPI4.50.2OSV
- transformers, PyPI4.50.3OSV
- transformers, PyPI4.51.0OSV
- transformers, PyPI4.51.1OSV
- transformers, PyPI4.51.2OSV
- transformers, PyPI4.51.3OSV
- transformers, PyPI4.52.0OSV
- transformers, PyPI4.52.1OSV
- transformers, PyPI4.52.2OSV
- transformers, PyPI4.52.3OSV
- transformers, PyPI4.52.4OSV
- transformers, PyPI4.53.0OSV
- transformers, PyPI4.53.1OSV
- transformers, PyPI4.53.2OSV
- transformers, PyPI4.53.3OSV
- transformers, PyPI4.54.0OSV
- transformers, PyPI4.54.1OSV
- transformers, PyPI4.55.0OSV
- transformers, PyPI4.55.1OSV
- transformers, PyPI4.55.2OSV
- transformers, PyPI4.55.3OSV
- transformers, PyPI4.55.4OSV
- transformers, PyPI4.56.0OSV
- transformers, PyPI4.56.1OSV
- transformers, PyPI4.56.2OSV
- transformers, PyPI4.57.0OSV
- transformers, PyPI4.57.1OSV
- transformers, PyPI4.57.2OSV
- transformers, PyPI4.57.3OSV
- transformers, PyPI4.57.4OSV
- transformers, PyPI4.57.5OSV
- transformers, PyPI4.57.6OSV
- transformers, PyPI5.0.0OSV
- transformers, PyPI5.0.0rc0OSV
- transformers, PyPI5.0.0rc1OSV
- transformers, PyPI5.0.0rc2OSV
- transformers, PyPI5.0.0rc3OSV
- transformers, PyPI5.1.0OSV
- transformers, PyPI5.2.0OSV
- transformers, PyPI5.3.0OSV
- transformers, PyPI5.4.0OSV
- transformers, PyPI5.5.0OSV
- transformers, PyPI5.5.1OSV
- transformers, PyPI5.5.2OSV
- transformers, PyPI5.5.3OSV
- transformers, PyPI5.5.4OSV
- transformers, PyPI5.6.0OSV
References 7
- github.com/huggingface/transformers/commit/cbc1651a032b923da7f4b44b3d0e6f68e6ba6b55Fixvia GitHub
- kb.cert.org/vuls/id/456290Advisoryvia CVE List
- kb.cert.org/vuls/id/456290Advisoryvia CVE List
- github.com/advisories/GHSA-x9r9-c232-4q39Advisoryvia GitHub
- nvd.nist.gov/vuln/detail/CVE-2026-80047Referencevia GitHub
- github.com/huggingface/transformers/pull/48620Referencevia GitHub
- github.com/huggingface/transformersReferencevia CVE List