{"cve":"CVE-2026-9856","nvd":{"published":"2026-08-02T16:16:25.413","modified":"2026-10-23T22:10:00.160","status":"Awaiting Analysis","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_v4":null,"cvss_v3":{"version":"3.0","vector":"CVSS:3.0/AV:N/AC:L/PR:N/UI:R/S:U/C:N/I:H/A:L","score":7.1},"cwes":["CWE-22"],"references":["https://github.com/huggingface/transformers/commit/eaaaf8494dd5386634ae37d1d122212fdc315be5","https://huntr.com/bounties/362824d5-fe18-40e8-a6cf-62277f97a170"],"products":[],"source":"nvd","synced_at":"2026-10-24T16:53:34.184483516+00:00"},"epss":{"cve":"CVE-2026-9856","score":0.0046,"percentile":0.39574,"date":"2026-10-25"},"kev":null,"osv":[{"id":"GHSA-xrqw-3rrv-vx5w","url":"https://osv.dev/vulnerability/GHSA-xrqw-3rrv-vx5w","summary":"Transformers save_pretrained path traversal allows arbitrary file writes through chat template names","modified":"2026-09-10T12:25:36.528730268Z","packages":[{"ecosystem":"PyPI","name":"transformers","purl":"pkg:pypi/transformers","ranges":["<5.10.0"],"fixed":["5.10.0"]}]},{"id":"PYSEC-2026-3929","url":"https://osv.dev/vulnerability/PYSEC-2026-3929","summary":"Transformers save_pretrained path traversal allows arbitrary file writes through chat template names","modified":"2026-09-10T12:15:13.263552340Z","packages":[{"ecosystem":"PyPI","name":"transformers","purl":"pkg:pypi/transformers","ranges":["<5.10.0"],"fixed":["5.10.0"]}]}],"attribution":["This product uses the NVD API but is not endorsed or certified by the NVD.","EPSS scores: FIRST Exploit Prediction Scoring System, https://www.first.org/epss","Known exploited vulnerabilities: CISA Known Exploited Vulnerabilities Catalog, https://www.cisa.gov/known-exploited-vulnerabilities-catalog","Package advisories: OSV (https://osv.dev), from the GitHub Advisory Database, PyPA, Go, RustSec and other ecosystem databases, under CC-BY 4.0 or CC0","CVE records: the CVE Program's CVE List (https://www.cve.org), under its terms of use (https://www.cve.org/Legal/TermsOfUse). CVE is a registered trademark of The MITRE Corporation; this product is not affiliated with the CVE Program."]}