{"id":"CVE-2026-9856","aliases":["CVE-2026-9856","GHSA-xrqw-3rrv-vx5w","PYSEC-2026-3929"],"related":[],"kind":"vulnerability","state":"published","title":"Path Traversal in huggingface/transformers","summary":"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.","summarySource":"cvelist","descriptions":[{"lang":"en","text":"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.","source":"cvelist"},{"lang":"en","text":"A vulnerability in huggingface/transformers versions < 5.10.0 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.","format":"markdown","source":"ghsa"},{"lang":"es","text":"Una vulnerabilidad en las versiones menor o igual que 5.8.0.dev0 de huggingface/transformers permite a un atacante realizar escrituras de archivos arbitrarias mediante salto de ruta. El problema reside en los métodos ’save_pretrained()’ de ’PreTrainedTokenizerBase’ y ’ProcessorMixin’, donde las claves del diccionario ’chat_template’ se utilizan directamente como nombres de archivo sin una validación adecuada. Un atacante puede explotar esto publicando un repositorio malicioso en Hugging Face Hub con un archivo ’tokenizer_config.json’ manipulado. Cuando una víctima descarga y guarda el tokenizador o procesador, las claves controladas por el atacante pueden escapar del directorio de guardado previsto, permitiendo escrituras de archivos arbitrarias con contenido controlado por el atacante. Esta vulnerabilidad afecta a múltiples procesadores que heredan de ’ProcessorMixin’, incluyendo Idefics, Florence, Gemma, Phi y Qwen-VL.","source":"nvd"}],"published":"2026-08-02T15:10:53.809Z","modified":"2026-10-23T22:10:00.160Z","severity":{"scorer":"@huntr_ai","scheme":"CVSS: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,"rating":"HIGH"},"severities":[{"scorer":"@huntr_ai","scheme":"CVSS: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,"rating":"HIGH"},{"scorer":"GitHub","scheme":"CVSS: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,"rating":"HIGH"},{"scorer":"PyPA Advisory Database","scheme":"CVSS: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,"rating":"HIGH"}],"cwes":["CWE-22"],"affected":[{"ranges":[{"type":"custom","introduced":"unspecified","fixed":"5.10.0","status":"affected"}],"vendor":"huggingface","product":"huggingface/transformers","source":"cvelist"},{"ranges":[{"type":"ecosystem","introduced":"0","status":"affected","fixed":"5.10.0"}],"ecosystem":"PyPI","package":"transformers","purl":"pkg:pypi/transformers","source":"ghsa"},{"ranges":[{"type":"ecosystem","introduced":"0","status":"affected","fixed":"5.10.0"}],"ecosystem":"PyPI","package":"transformers","purl":"pkg:pypi/transformers","source":"pysec"}],"references":[{"url":"https://huntr.com/bounties/362824d5-fe18-40e8-a6cf-62277f97a170","tags":["web"],"sources":["cvelist","ghsa","nvd","pysec"]},{"url":"https://github.com/huggingface/transformers/commit/eaaaf8494dd5386634ae37d1d122212fdc315be5","tags":["web"],"sources":["cvelist","ghsa","nvd","pysec"]},{"url":"https://nvd.nist.gov/vuln/detail/CVE-2026-9856","tags":["advisory"],"sources":["ghsa","pysec"]},{"url":"https://github.com/huggingface/transformers/pull/46191","tags":["web"],"sources":["ghsa","pysec"]},{"url":"https://github.com/huggingface/transformers","tags":["package"],"sources":["ghsa","pysec"]},{"url":"https://pypi.org/project/transformers","tags":["package"],"sources":["pysec"]},{"url":"https://github.com/advisories/GHSA-xrqw-3rrv-vx5w","tags":["advisory"],"sources":["pysec"]}],"credits":[],"assigner":"@huntr_ai","ssvc":{"scorer":"CISA-ADP","exploitation":"none","automatable":"no","technicalImpact":"partial","date":"2026-08-03T14:57:31.978Z"},"sources":[{"source":"cvelist","name":"CVE List","id":"CVE-2026-9856","url":"https://www.cve.org/CVERecord?id=CVE-2026-9856","licence":"CVE Terms of Use","modified":"2026-08-03T14:57:43.370Z"},{"source":"ghsa","name":"GitHub Advisory Database","id":"GHSA-xrqw-3rrv-vx5w","url":"https://github.com/advisories/GHSA-xrqw-3rrv-vx5w","licence":"CC-BY-4.0","modified":"2026-09-10T12:25:36.528Z"},{"source":"nvd","name":"NVD","id":"CVE-2026-9856","url":"https://nvd.nist.gov/vuln/detail/CVE-2026-9856","licence":"Public domain","modified":"2026-10-23T22:10:00.160Z"},{"source":"pysec","name":"PyPA Advisory Database","id":"PYSEC-2026-3929","url":"https://osv.dev/vulnerability/PYSEC-2026-3929","licence":"CC-BY-4.0","modified":"2026-09-10T12:15:13.263Z"}],"updatedAt":"2026-11-25T22:59:30.817Z","epss":{"score":0.00359,"percentile":0.31721,"date":"2026-12-01T12:00:22.000Z"}}