Incorrect Authorization Affecting transformers package, versions [4.49.0,]


Severity

Recommended
0.0
high
0
10

CVSS assessment by Snyk's Security Team. Learn more

Threat Intelligence

EPSS
0.08% (1st percentile)

Do your applications use this vulnerable package?

In a few clicks we can analyze your entire application and see what components are vulnerable in your application, and suggest you quick fixes.

Test your applications

Snyk Learn

Learn about Incorrect Authorization vulnerabilities in an interactive lesson.

Start learning
  • Snyk IDSNYK-PYTHON-TRANSFORMERS-19500670
  • published2 Sept 2026
  • disclosed1 Sept 2026
  • creditPrasanna Dabi

Introduced: 1 Sep 2026

NewCVE-2026-80047  (opens in a new tab)
CWE-863  (opens in a new tab)

How to fix?

There is no fixed version for transformers.

Overview

transformers is a State-of-the-art Machine Learning for JAX, PyTorch and TensorFlow

Affected versions of this package are vulnerable to Incorrect Authorization in the load_custom_generate() method of GenerativePreTrainedModel, where get_cached_module_file() in dynamic_module_utils.py copies the model's custom_generate/generate.py into the local module cache before the resolve_trust_remote_code() consent check runs. An attacker can plant a Python file in the victim's cache at ~/.cache/huggingface/modules even after the user declines the trust prompt, priming it for execution during a later trusted operation that reuses the cache, by publishing a model repository containing a malicious custom_generate/generate.py. Only the file write bypasses authorization, since execution of the cached module remains gated by the consent check, and exploitation requires the victim to call load_custom_generate() on the attacker's repository.

Workaround

This vulnerability can be avoided by regularly inspecting and clearing the Hugging Face module cache at ~/.cache/huggingface/modules, which removes any file written before the trust prompt was declined.

CVSS Base Scores

version 4.0
version 3.1