CVE-2026-9856: Path Traversal in huggingface/transformers
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 savepretrained() methods of PreTrainedTokenizerBase and ProcessorMixin, where keys from the chattemplate 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 tokenizerconfig.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 Software
Event History
Frequently Asked Questions
What is the severity of CVE-2026-9856?
CVE-2026-9856 has a high severity rating of 7.1.
How do I fix CVE-2026-9856?
To fix CVE-2026-9856, upgrade the huggingface/transformers library to a version newer than 5.8.0.dev0.
What types of attacks are possible with CVE-2026-9856?
CVE-2026-9856 allows attackers to perform arbitrary file writes through path traversal.
What versions are affected by CVE-2026-9856?
CVE-2026-9856 affects all huggingface/transformers versions up to and including 5.8.0.dev0.
What components are impacted by CVE-2026-9856?
CVE-2026-9856 impacts the save_pretrained() methods of the PreTrainedTokenizerBase and ProcessorMixin classes.