---
schema_version: '1.0'
id: security-20260910-d2cd06
title: 'CVE-2026-9856: Transformers save_pretrained path traversal allows arbitrary
  file writes through chat template names'
url: https://osv.dev/vulnerability/PYSEC-2026-3929
url_hash: d2cd06aab6a290fbac61691148b4def3cbd417305ef90a8f71dde7a67ac03057
canonical_url: https://osv.dev/vulnerability/PYSEC-2026-3929
source: osv:pypa
category: security/library
category_raw: cve/library
region: null
tags:
- cve
- CVE-2026-9856
- PYSEC-2026-3929
- 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-09-10T09:44:51Z'
fetched_at: '2026-09-10T15:44:18.057625Z'
updated_at: '2026-09-10T15:52:22Z'
status: published
content_hash: a32e4f56ff9abe82a81a13e67467c1f1ec6eac1d4fbe52ec45c7c6f8a1daecd5
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-9856
- ex_path
- file
- library vulnerability
- names
- path
- PyPI
- PYSEC-2026-3929
- save_pretrained
- severity:CVSS:3.0/AV:N/AC:L/PR:N/UI:R/S:U/C:N/I:H/A:L
- software security
- Standard Transformers
- template
- through
- transformers
- traversal
- writes
entities_en:
- name: CVE
  type: data
- name: ex_path
  type: location
- name: Standard Transformers
  type: organization
topics_en:
- library vulnerability
- software security
numeric_facts: []
entities:
- name: CVE
  type: data
- name: Standard Transformers
  type: organization
- name: ex_path
  type: location
key_facts: []
related: []
related_auto:
- name: me_path
  type: location
  weight: 8.6
- name: 集団的免疫力
  type: concept
  weight: 1.0
computed_at: '2026-09-10T15:52:18Z'
---

# 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 / PYSEC-2026-3929 / 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:** PYSEC-2026-3929 (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
- https://pypi.org/project/transformers
- https://github.com/advisories/GHSA-xrqw-3rrv-vx5w

_Data: OSV.dev (upstream: pypa) — https://osv.dev/vulnerability/PYSEC-2026-3929_

## Source
元記事: [CVE-2026-9856: Transformers save_pretrained path traversal allows arbitrary file writes through chat template names](https://osv.dev/vulnerability/PYSEC-2026-3929) — published 2026-09-10T09:44:51Z
