All vulnerabilities
CVE-2026-80047GHSA-x9r9-c232-4q39PYSEC-2026-4174

Hugging Face Transformers downloads custom generation code before trust consent

Hugging Face transformerspipLibraries & packages
CVSS
7.8High
ExploitationNo known exploitationNot in CISA KEV, which does not prove it is unexploitedCISA KEV
Exploit odds (EPSS)0.10%Chance of exploitation activity in the next 30 days, higher than 0% of CVEs. Scored 23 Oct 2026FIRST EPSS
Fixed inNone listedNo source names a fixed version. Check the vendor advisory below
Published1 Sep 2026Updated 1 Oct 2026CVE List

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