# CVE-2026-9856: Path Traversal in huggingface/transformers

> CVE-2026-9856: Path Traversal in huggingface/transformers. CVSS 7.1 (CVSS 3.1).

Canonical: https://rewindex.com/cve/CVE-2026-9856
Last updated: 2026-10-23T22:10:00Z

- Published: 2026-08-02 15:10 UTC · Updated: 2026-10-23 22:10 UTC · Assigner: @huntr\_ai
- CVSS: 7.1 (CVSS 3.1) · Severity: High · Vector: CVSS:3.0/AV:N/AC:L/PR:N/UI:R/S:U/C:N/I:H/A:L
- EPSS: 0.46%, 40th percentile (scored 2026-10-25)
- CISA KEV: no
- CWE: CWE-22

## 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.

## Affected vendors and products

- huggingface: huggingface/transformers

## Tracked companies

- [Hugging Face](https://rewindex.com/company/hugging-face.md)

## References

- [CVE record on cve.org](https://www.cve.org/CVERecord?id=CVE-2026-9856)
- [NVD entry](https://nvd.nist.gov/vuln/detail/CVE-2026-9856)
- [https://github.com/huggingface/transformers/commit/eaaaf8494dd5386634ae37d1d122212fdc315be5](https://github.com/huggingface/transformers/commit/eaaaf8494dd5386634ae37d1d122212fdc315be5)
- [https://huntr.com/bounties/362824d5-fe18-40e8-a6cf-62277f97a170](https://huntr.com/bounties/362824d5-fe18-40e8-a6cf-62277f97a170)

---

_Sources: CVE records from the CVE Program (cve.org). CVE® is a registered trademark of The MITRE Corporation. (https://www.cve.org/) This product uses data from the NVD API but is not endorsed or certified by the NVD. (https://nvd.nist.gov/) Known Exploited Vulnerabilities catalog from CISA. (https://www.cisa.gov/known-exploited-vulnerabilities-catalog) EPSS scores from FIRST (Exploit Prediction Scoring System). (https://www.first.org/epss/)_


---
Canonical: https://rewindex.com/cve/CVE-2026-9856 · Markdown: https://rewindex.com/cve/CVE-2026-9856.md · JSON: https://rewindex.com/api/v1/cves/CVE-2026-9856 · Data licensed CC BY 4.0 (https://creativecommons.org/licenses/by/4.0/) · Generated 2026-10-26T02:50:13.468Z
