---
schema_version: '1.0'
id: security-20260902-b158b9
title: 'CVE-2026-9856: Transformers save_pretrained path traversal allows arbitrary
  file writes through chat template names'
url: https://osv.dev/vulnerability/GHSA-xrqw-3rrv-vx5w
url_hash: b158b902aa83e5ca3026c3daca3eabb29939fae8a2ee354a26640b72c83f5b8c
canonical_url: https://osv.dev/vulnerability/GHSA-xrqw-3rrv-vx5w
source: osv:ghsa
category: security/library
category_raw: cve/library
region: null
tags:
- cve
- CVE-2026-9856
- GHSA-xrqw-3rrv-vx5w
- severity:CVSS:3.0/AV:N/AC:L/PR:N/UI:R/S:U/C:N/I:H/A:L
- transformers
- PyPI
lang: en
published_at: '2026-08-02T18:30:20Z'
fetched_at: '2026-09-02T03:48:10.008749Z'
updated_at: '2026-09-02T03:54:31Z'
status: published
content_hash: 2a834270688d713a590a2fd7f9d6f251260b668b8f4c1d1aa1ac6d2c131d007e
content_changed_at: null
license_note: full
summary: Transformers save_pretrained path traversal allows arbitrary file writes
  through chat template names
summary_source: rss
summary_en: Transformers save_pretrained path traversal allows arbitrary file writes
  through chat template names
summary_omitted_reason: null
redistribution: true
keywords_en:
- allows
- arbitrary
- chat
- cve
- CVE-2026-28684
- CVE-2026-9856
- file
- GHSA-xrqw-3rrv-vx5w
- library vulnerability
- names
- path
- PyPI
- save_pretrained
- severity:CVSS:3.0/AV:N/AC:L/PR:N/UI:R/S:U/C:N/I:H/A:L
- software security
- template
- through
- transformers
- transformers.js
- traversal
- writes
entities_en:
- name: CVE-2026-28684
  type: event
- name: transformers.js
  type: artifact
topics_en:
- library vulnerability
- software security
numeric_facts: []
entities:
- name: CVE-2026-28684
  type: event
- name: transformers.js
  type: artifact
key_facts: []
related: []
related_auto:
- name: WasmEdge
  type: organization
  weight: 1.0
computed_at: '2026-09-02T03:54:13Z'
---

# CVE-2026-9856: Transformers save_pretrained path traversal allows arbitrary file writes through chat template names

## TL;DR
Transformers save_pretrained path traversal allows arbitrary file writes through chat template names

## Key Points
- cve / CVE-2026-9856 / GHSA-xrqw-3rrv-vx5w / severity:CVSS:3.0/AV:N/AC:L/PR:N/UI:R/S:U/C:N/I:H/A:L / transformers / PyPI

## Details
**Severity:** CVSS:3.0/AV:N/AC:L/PR:N/UI:R/S:U/C:N/I:H/A:L
**Advisory:** GHSA-xrqw-3rrv-vx5w (CVE-2026-9856)

**Details:**
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.

**References:**
- https://nvd.nist.gov/vuln/detail/CVE-2026-9856
- https://github.com/huggingface/transformers/pull/46191
- https://github.com/huggingface/transformers/commit/eaaaf8494dd5386634ae37d1d122212fdc315be5
- https://github.com/huggingface/transformers
- https://huntr.com/bounties/362824d5-fe18-40e8-a6cf-62277f97a170

_Data: OSV.dev (upstream: ghsa) — https://osv.dev/vulnerability/GHSA-xrqw-3rrv-vx5w_

## Source
元記事: [CVE-2026-9856: Transformers save_pretrained path traversal allows arbitrary file writes through chat template names](https://osv.dev/vulnerability/GHSA-xrqw-3rrv-vx5w) — published 2026-08-02T18:30:20Z
