CVE-2026-9856
Published:August 02, 2026
Updated:August 04, 2026
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.
Affected Packages
transformers (CONDA):
Affected version(s) >=2.1.1 <5.10.0Fix Suggestion:
Update to version 5.10.0https://github.com/huggingface/transformers.git (GITHUB):
Affected version(s) >=v5.0.0 <v5.10.0Fix Suggestion:
Update to version v5.10.0transformers (PYTHON):
Affected version(s) >=0.1 <5.10.0Fix Suggestion:
Update to version 5.10.0Related Resources (4)
Do you need more information?
Contact UsCVSS v4
Base Score:
7.1
Attack Vector
NETWORK
Attack Complexity
LOW
Attack Requirements
NONE
Privileges Required
NONE
User Interaction
PASSIVE
Vulnerable System Confidentiality
NONE
Vulnerable System Integrity
HIGH
Vulnerable System Availability
LOW
Subsequent System Confidentiality
NONE
Subsequent System Integrity
NONE
Subsequent System Availability
NONE
CVSS v3
Base Score:
7.1
Attack Vector
NETWORK
Attack Complexity
LOW
Privileges Required
NONE
User Interaction
REQUIRED
Scope
UNCHANGED
Confidentiality
NONE
Integrity
HIGH
Availability
LOW
Weakness Type (CWE)
Improper Limitation of a Pathname to a Restricted Directory ('Path Traversal')
EPSS
Base Score:
0.29