CVE-2026-80047: Hugging Face Transformers - Unauthorized File Write Vulnerability

transformers Updated 01 Oct 2026

Summary

01/10/2026
No i
High
7.8

CVE-2026-80047: Hugging Face Transformers downloads custom generation code before trust consent. Affects transformers versions >= 4.49.0, <= 5.8.1. No fix is published. How to fix ↓

Free scan

Check if this vulnerability affects your application

Upload a manifest or SBOM and we'll show whether you're affected, plus every other risky package in the same scan.

Check my app free

No signup required · Results in about 60 seconds

Upload your dependency manifest or SBOM

Drag & drop your file here or

Java Javascript PHP Python Go Rust Ruby Dart C/C++ Elixir CycloneDX SPDX

Upload a supported dependency manifest or SBOM. No installation or source-code access required.

See supported files and SBOM formats
SBOM sbom.json · bom.json · bom.xml · *.spdx.json · *.cdx.json · *.cdx.xml
Java pom.xml · gradle.lockfile · buildscript-gradle.lockfile
Javascript package-lock.json · yarn.lock · pnpm-lock.yaml
PHP composer.lock
Python poetry.lock · requirements.txt · Pipfile.lock
Go go.mod
Rust Cargo.lock
Ruby Gemfile.lock
Dart pubspec.lock
C/C++ conan.lock
Elixir mix.lock
Enter your work email to receive your report link.

Verify your email to view the full report and start 30 days of continuous monitoring. No credit card required.

Sponsored Devnack Mobile apps built by Devnack Design, build and launch iOS and Android apps with a senior product team. From idea to store release Start a project

Background

Hugging Face Transformers is a popular open-source library that provides state-of-the-art machine learning models for natural language processing tasks. It allows users to easily download and utilize pre-trained models for various applications, including text generation, translation, and sentiment analysis. The library is widely used in both research and production environments due to its flexibility and extensive model support. However, a recent vulnerability has been identified that compromises the security model of the library, allowing unauthorized file writes to the local disk.

Vulnerability Detail

A vulnerability in Hugging Face Transformers (versions 4.49.0 to 5.8.1) allows remote Python files to be written to the local disk without user consent when using the GenerativePreTrainedModel.load_custom_generate() function. This function fetches and caches a remote module file before performing the required trust_remote_code consent check, which inverts the security model enforced by other code-loading paths. As a result, attacker-controlled Python code from custom_generate/generate.py can be copied into the user's ~/.cache/huggingface/modules directory even if the user declines the trust prompt. Although execution is gated correctly, the file write is irreversible and can persist across sessions, leading to unauthorized files on disk and potential stale cache collisions during trusted model loads. The issue originates from an unconditional file write in dynamic_module_utils.py prior to any trust verification.

How To Fix

No fixed version is published for this vulnerability.

Tip — Not sure whether your app is affected? Vulert can check the versions your app actually runs. Scan free →

Workaround

As a temporary workaround, avoid using the load_custom_generate() function until you can update to a patched version. Additionally, regularly clear the ~/.cache/huggingface/modules directory to remove any potentially malicious files.

Conclusion

The Hugging Face Transformers library has a significant vulnerability that allows unauthorized file writes to the local disk. Users are strongly advised to update to a patched version to mitigate the risks associated with this issue. Regular monitoring and clearing of cache directories can help reduce exposure until an update can be applied.

See every vulnerability recorded for transformers →

Share this vulnerability

FAQ

The vulnerability affects Hugging Face Transformers versions 4.49.0 to 5.8.1.

If you cannot update the package, refrain from using the load_custom_generate() function and clear the cache directory regularly.

You can use Vulert, which monitors and alerts for open-source vulnerabilities in real-time. You can check your application using the Vulert playground at Vulert Scanner without any signup.

The risks include unauthorized file writes to the local disk, which can lead to persistent malicious files and potential execution of attacker-controlled code.

The CVSS score for this vulnerability is 7.8, indicating a high level of severity.

Related vulnerabilities

Recent vulnerabilities recorded for transformers.

How To Fix

No fixed version is published for this vulnerability.

Tip — Not sure whether your app is affected? Vulert can check the versions your app actually runs. Scan free →

Subscribe to Vulert on Telegram
Daily digest of new CVEs, critical and high severity, affected packages and fixes — plus a weekly roundup.
Join the channel →
Help improve this record
Report an issue or send feedback