PYSEC-2026-3929
Vulnerability from pysec - Published: 2026-09-10 09:44 - Updated: 2026-09-10 11:02A 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.
| Name | purl | transformers | pkg:pypi/transformers |
|---|
{
"affected": [
{
"package": {
"ecosystem": "PyPI",
"name": "transformers",
"purl": "pkg:pypi/transformers"
},
"ranges": [
{
"events": [
{
"introduced": "0"
},
{
"fixed": "5.10.0"
}
],
"type": "ECOSYSTEM"
}
],
"versions": [
"0.1",
"2.0.0",
"2.1.0",
"2.1.1",
"2.10.0",
"2.11.0",
"2.2.0",
"2.2.1",
"2.2.2",
"2.3.0",
"2.4.0",
"2.4.1",
"2.5.0",
"2.5.1",
"2.6.0",
"2.7.0",
"2.8.0",
"2.9.0",
"2.9.1",
"3.0.0",
"3.0.1",
"3.0.2",
"3.1.0",
"3.2.0",
"3.3.0",
"3.3.1",
"3.4.0",
"3.5.0",
"3.5.1",
"4.0.0",
"4.0.0rc1",
"4.0.1",
"4.1.0",
"4.1.1",
"4.10.0",
"4.10.1",
"4.10.2",
"4.10.3",
"4.11.0",
"4.11.1",
"4.11.2",
"4.11.3",
"4.12.0",
"4.12.1",
"4.12.2",
"4.12.3",
"4.12.4",
"4.12.5",
"4.13.0",
"4.14.0",
"4.14.1",
"4.15.0",
"4.16.0",
"4.16.1",
"4.16.2",
"4.17.0",
"4.18.0",
"4.19.0",
"4.19.1",
"4.19.2",
"4.19.3",
"4.19.4",
"4.2.0",
"4.2.1",
"4.2.2",
"4.20.0",
"4.20.1",
"4.21.0",
"4.21.1",
"4.21.2",
"4.21.3",
"4.22.0",
"4.22.1",
"4.22.2",
"4.23.0",
"4.23.1",
"4.24.0",
"4.25.0",
"4.25.1",
"4.26.0",
"4.26.1",
"4.27.0",
"4.27.1",
"4.27.2",
"4.27.3",
"4.27.4",
"4.28.0",
"4.28.1",
"4.29.0",
"4.29.1",
"4.29.2",
"4.3.0",
"4.3.0rc1",
"4.3.1",
"4.3.2",
"4.3.3",
"4.30.0",
"4.30.1",
"4.30.2",
"4.31.0",
"4.32.0",
"4.32.1",
"4.33.0",
"4.33.1",
"4.33.2",
"4.33.3",
"4.34.0",
"4.34.1",
"4.35.0",
"4.35.1",
"4.35.2",
"4.36.0",
"4.36.1",
"4.36.2",
"4.37.0",
"4.37.1",
"4.37.2",
"4.38.0",
"4.38.1",
"4.38.2",
"4.39.0",
"4.39.1",
"4.39.2",
"4.39.3",
"4.4.0",
"4.4.1",
"4.4.2",
"4.40.0",
"4.40.1",
"4.40.2",
"4.41.0",
"4.41.1",
"4.41.2",
"4.42.0",
"4.42.1",
"4.42.2",
"4.42.3",
"4.42.4",
"4.43.0",
"4.43.1",
"4.43.2",
"4.43.3",
"4.43.4",
"4.44.0",
"4.44.1",
"4.44.2",
"4.45.0",
"4.45.1",
"4.45.2",
"4.46.0",
"4.46.1",
"4.46.2",
"4.46.3",
"4.47.0",
"4.47.1",
"4.48.0",
"4.48.1",
"4.48.2",
"4.48.3",
"4.49.0",
"4.5.0",
"4.5.1",
"4.50.0",
"4.50.1",
"4.50.2",
"4.50.3",
"4.51.0",
"4.51.1",
"4.51.2",
"4.51.3",
"4.52.0",
"4.52.1",
"4.52.2",
"4.52.3",
"4.52.4",
"4.53.0",
"4.53.1",
"4.53.2",
"4.53.3",
"4.54.0",
"4.54.1",
"4.55.0",
"4.55.1",
"4.55.2",
"4.55.3",
"4.55.4",
"4.56.0",
"4.56.1",
"4.56.2",
"4.57.0",
"4.57.1",
"4.57.2",
"4.57.3",
"4.57.4",
"4.57.5",
"4.57.6",
"4.6.0",
"4.6.1",
"4.7.0",
"4.8.0",
"4.8.1",
"4.8.2",
"4.9.0",
"4.9.1",
"4.9.2",
"5.0.0",
"5.0.0rc0",
"5.0.0rc1",
"5.0.0rc2",
"5.0.0rc3",
"5.1.0",
"5.2.0",
"5.3.0",
"5.4.0",
"5.5.0",
"5.5.1",
"5.5.2",
"5.5.3",
"5.5.4",
"5.6.0",
"5.6.1",
"5.6.2",
"5.7.0",
"5.8.0",
"5.8.1",
"5.9.0"
]
}
],
"aliases": [
"CVE-2026-9856",
"GHSA-xrqw-3rrv-vx5w"
],
"details": "A vulnerability in huggingface/transformers versions \u003c 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.",
"id": "PYSEC-2026-3929",
"modified": "2026-09-10T11:02:34.656018Z",
"published": "2026-09-10T09:44:51.053247Z",
"references": [
{
"type": "ADVISORY",
"url": "https://nvd.nist.gov/vuln/detail/CVE-2026-9856"
},
{
"type": "WEB",
"url": "https://github.com/huggingface/transformers/pull/46191"
},
{
"type": "WEB",
"url": "https://github.com/huggingface/transformers/commit/eaaaf8494dd5386634ae37d1d122212fdc315be5"
},
{
"type": "PACKAGE",
"url": "https://github.com/huggingface/transformers"
},
{
"type": "WEB",
"url": "https://huntr.com/bounties/362824d5-fe18-40e8-a6cf-62277f97a170"
},
{
"type": "PACKAGE",
"url": "https://pypi.org/project/transformers"
},
{
"type": "ADVISORY",
"url": "https://github.com/advisories/GHSA-xrqw-3rrv-vx5w"
}
],
"severity": [
{
"score": "CVSS:3.0/AV:N/AC:L/PR:N/UI:R/S:U/C:N/I:H/A:L",
"type": "CVSS_V3"
}
],
"summary": "Transformers save_pretrained path traversal allows arbitrary file writes through chat template names"
}
Drag nodes to arrange them. Double-click a related vulnerability to open it, or a source to visit its link. The Physics button on the left tunes the layout and the simulation; the legend at the bottom left hides or shows nodes by kind and by sighting type.
Sightings
| Author | Source | Type | Date | Other |
|---|
Nomenclature
- Seen: The vulnerability was mentioned, discussed, or observed by the user.
- Confirmed: The vulnerability has been validated from an analyst's perspective.
- Published Proof of Concept: A public proof of concept is available for this vulnerability.
- Exploited: The vulnerability was observed as exploited by the user who reported the sighting.
- Patched: The vulnerability was observed as successfully patched by the user who reported the sighting.
- Not exploited: The vulnerability was not observed as exploited by the user who reported the sighting.
- Not confirmed: The user expressed doubt about the validity of the vulnerability.
- Not patched: The vulnerability was not observed as successfully patched by the user who reported the sighting.
Vulnerability timeline
Sightings and recorded dates, grouped by day · UTC
How durations are calculated
Following the VTEM framework (Black Hat USA 2015), time to patch starts when the vendor or a coordinator was informed, total time to patch at discovery, and disclosure to patch at public disclosure; vendor response time runs from the report to its acknowledgement. Time to exploit and time unpatched start at the earliest discovery or report, falling back to public disclosure. Unpatched time ends at the first recorded patch, or the calculation time when no patch is recorded. Exploitation to patch shows the interval between those two events; a published proof of concept is a public exploit, not exploitation. The method is described in a publication.
Each result shows its source dates. A negative interval means the end event came first; when date-only inputs leave the order open, the result says so. Date-only inputs are approximate. The earliest evidence wins: KEV report dates and sightings are labelled as such. Records describing another vulnerability are listed but never calculated from, and a PoC alone does not establish exploitation. Missing patch evidence does not prove that no patch exists. Filters below change the event list only.
Loading timeline…
The approach is described in our paper Mapping CVEs to MITRE ATT&CK Techniques: A Curated Gold-Set Classifier and the Limits of LLM-Assisted Label Expansion.
Browse all ATT&CK techniques and the vulnerabilities related to each.
Related by attack behaviour
Vulnerabilities whose description is nearest to this one in the vector space of the CIRCL/vulnerability-attack-technique-biencoder model. This is a similarity search over the bi-encoder space (plain cosine), not a classification, and it has no measured accuracy.