CVE-2026-9856
Received Received - Intake

Arbitrary File Write via Path Traversal in Hugging Face Transformers

Vulnerability report for CVE-2026-9856, including description, CVSS score, EPSS score, affected products, exploitability, helpful resources, and attack-flow context.

Publication date: 2026-08-02

Last updated on: 2026-08-02

Assigner: huntr.dev

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.

CVSS Scores

EPSS Scores

Probability:
Percentile:

Meta Information

Published
2026-08-02
Last Modified
2026-08-02
Generated
2026-08-02
AI Q&A
2026-08-02
EPSS Evaluated
N/A
NVD
EUVD

Affected Vendors & Products

Showing 1 associated CPE
Vendor Product Version / Range
huggingface transformers to 5.8.0.dev0 (inc)

Helpful Resources

Exploitability

CWE
CWE Icon
KEV
KEV Icon
CWE ID Description
CWE-22 The product uses external input to construct a pathname that is intended to identify a file or directory that is located underneath a restricted parent directory, but the product does not properly neutralize special elements within the pathname that can cause the pathname to resolve to a location that is outside of the restricted directory.

Attack-Flow Graph

AI Quick Actions

Instant insights powered by AI
Executive Summary

This vulnerability allows an attacker to write arbitrary files to a victim's system through path traversal. It exists in Hugging Face Transformers versions up to 5.8.0.dev0, specifically in the save_pretrained() methods of PreTrainedTokenizerBase and ProcessorMixin. Attackers 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, attacker-controlled keys in the chat_template dictionary can escape the intended save directory, enabling arbitrary file writes with attacker-controlled content.

Detection Guidance

To detect this vulnerability, inspect Hugging Face Transformers installations for versions <=5.8.0.dev0. Check for unauthorized file writes in directories where tokenizers or processors are saved. Review tokenizer_config.json files in downloaded repositories for malicious chat_template keys.

Impact Analysis

This vulnerability could allow an attacker to overwrite critical system files, install malware, or gain control of your system. If you use affected Hugging Face Transformers versions, an attacker could trick you into downloading a malicious tokenizer or processor, leading to arbitrary file writes on your machine. This could compromise your system integrity, data security, and privacy.

Compliance Impact

This vulnerability could lead to non-compliance with GDPR and HIPAA by enabling arbitrary file writes. Attackers may overwrite sensitive files like configuration files or logs, potentially exposing or altering protected health information (PHI) under HIPAA or personal data under GDPR. Unauthorized file modifications could also violate integrity and confidentiality requirements.

Mitigation Strategies

Update huggingface/transformers to a version greater than 5.8.0.dev0 to address the arbitrary file write vulnerability. Avoid using untrusted Hugging Face Hub repositories or verify the integrity of tokenizer_config.json files before downloading and saving tokenizers or processors.

Chat Assistant

Ask questions about this CVE
Hi! I’m here to help you understand CVE-2026-9856. Ask me anything about the vulnerability, its impact, or mitigation strategies.
0/70

EPSS Chart