CVE-2026-9856
Path Traversal in huggingface/transformers
Description
A vulnerability in huggingface/transformers versions <=5.8.0.dev0 allows an attacker to perform arbitrary file writes via path traversal. The issue resides in the `save_pretrained()` methods of `PreTrainedTokenizerBase` and `ProcessorMixin`, where keys from the `chat_template` dictionary are used directly as filenames without proper validation. An attacker can exploit this by publishing a malicious Hugging Face Hub repository with a crafted `tokenizer_config.json` file. When a victim downloads and saves the tokenizer or processor, the attacker-controlled keys can escape the intended save directory, enabling arbitrary file writes with attacker-controlled content. This vulnerability affects multiple processors inheriting from `ProcessorMixin`, including Idefics, Florence, Gemma, Phi, and Qwen-VL.
INFO
Published Date :
Aug. 2, 2026, 4:16 p.m.
Last Modified :
Aug. 2, 2026, 4:16 p.m.
Remotely Exploit :
Yes !
Source :
[email protected]
CVSS Scores
| Score | Version | Severity | Vector | Exploitability Score | Impact Score | Source |
|---|---|---|---|---|---|---|
| CVSS 3.0 | HIGH | [email protected] | ||||
| CVSS 3.0 | HIGH | MITRE-CVE |
Solution
- Update huggingface/transformers to the latest version.
- Ensure keys from chat_template are properly validated.
- Avoid using untrusted tokenizer configurations.
References to Advisories, Solutions, and Tools
Here, you will find a curated list of external links that provide in-depth
information, practical solutions, and valuable tools related to
CVE-2026-9856.
| URL | Resource |
|---|---|
| https://github.com/huggingface/transformers/commit/eaaaf8494dd5386634ae37d1d122212fdc315be5 | |
| https://huntr.com/bounties/362824d5-fe18-40e8-a6cf-62277f97a170 |
CWE - Common Weakness Enumeration
While CVE identifies
specific instances of vulnerabilities, CWE categorizes the common flaws or
weaknesses that can lead to vulnerabilities. CVE-2026-9856 is
associated with the following CWEs:
Common Attack Pattern Enumeration and Classification (CAPEC)
Common Attack Pattern Enumeration and Classification
(CAPEC)
stores attack patterns, which are descriptions of the common attributes and
approaches employed by adversaries to exploit the CVE-2026-9856
weaknesses.
We scan GitHub repositories to detect new proof-of-concept exploits. Following list is a collection of public exploits and proof-of-concepts, which have been published on GitHub (sorted by the most recently updated).
Results are limited to the first 15 repositories due to potential performance issues.
The following list is the news that have been mention
CVE-2026-9856 vulnerability anywhere in the article.
The following table lists the changes that have been made to the
CVE-2026-9856 vulnerability over time.
Vulnerability history details can be useful for understanding the evolution of a vulnerability, and for identifying the most recent changes that may impact the vulnerability's severity, exploitability, or other characteristics.
-
New CVE Received by [email protected]
Aug. 02, 2026
Action Type Old Value New Value Added Affected [{'vendor': 'huggingface', 'product': 'huggingface/transformers', 'versions': [{'status': 'affected', 'version': 'unspecified', 'lessThan': '5.10.0', 'versionType': 'custom'}]}] Added Description A vulnerability in huggingface/transformers versions <=5.8.0.dev0 allows an attacker to perform arbitrary file writes via path traversal. The issue resides in the `save_pretrained()` methods of `PreTrainedTokenizerBase` and `ProcessorMixin`, where keys from the `chat_template` dictionary are used directly as filenames without proper validation. An attacker can exploit this by publishing a malicious Hugging Face Hub repository with a crafted `tokenizer_config.json` file. When a victim downloads and saves the tokenizer or processor, the attacker-controlled keys can escape the intended save directory, enabling arbitrary file writes with attacker-controlled content. This vulnerability affects multiple processors inheriting from `ProcessorMixin`, including Idefics, Florence, Gemma, Phi, and Qwen-VL. Added CVSS V3 AV:N/AC:L/PR:N/UI:R/S:U/C:N/I:H/A:L Added CWE CWE-22 Added Reference https://github.com/huggingface/transformers/commit/eaaaf8494dd5386634ae37d1d122212fdc315be5 Added Reference https://huntr.com/bounties/362824d5-fe18-40e8-a6cf-62277f97a170