← Back to CVE Explorer

CVE-2026-9856

Full vulnerability record from the local CVENow database.

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.

Severity
HIGH
CVSS score
7.1 (v3.0)
Vulnerability status
Awaiting Analysis
Source identifier
Published
2026-08-02 16:16:25.413000
Last modified
2026-10-23 22:10:00.160000
View original CVE JSON
{
  "id": "CVE-2026-9856",
  "sourceIdentifier": "[email protected]",
  "published": "2026-08-02T16:16:25.413",
  "lastModified": "2026-10-23T22:10:00.160",
  "vulnStatus": "Awaiting Analysis",
  "cveTags": [],
  "descriptions": [
    {
      "lang": "en",
      "value": "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."
    },
    {
      "lang": "es",
      "value": "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."
    }
  ],
  "affected": [
    {
      "source": "[email protected]",
      "affectedData": [
        {
          "vendor": "huggingface",
          "product": "huggingface/transformers",
          "versions": [
            {
              "version": "unspecified",
              "lessThan": "5.10.0",
              "versionType": "custom",
              "status": "affected"
            }
          ]
        }
      ]
    }
  ],
  "metrics": {
    "cvssMetricV30": [
      {
        "source": "[email protected]",
        "type": "Secondary",
        "cvssData": {
          "version": "3.0",
          "vectorString": "CVSS:3.0/AV:N/AC:L/PR:N/UI:R/S:U/C:N/I:H/A:L",
          "baseScore": 7.1,
          "baseSeverity": "HIGH",
          "attackVector": "NETWORK",
          "attackComplexity": "LOW",
          "privilegesRequired": "NONE",
          "userInteraction": "REQUIRED",
          "scope": "UNCHANGED",
          "confidentialityImpact": "NONE",
          "integrityImpact": "HIGH",
          "availabilityImpact": "LOW"
        },
        "exploitabilityScore": 2.8,
        "impactScore": 4.2
      }
    ],
    "ssvcV203": [
      {
        "source": "134c704f-9b21-4f2e-91b3-4a467353bcc0",
        "ssvcData": {
          "timestamp": "2026-08-03T14:57:31.978427Z",
          "id": "CVE-2026-9856",
          "options": [
            {
              "exploitation": "none"
            },
            {
              "automatable": "no"
            },
            {
              "technicalImpact": "partial"
            }
          ],
          "role": "CISA Coordinator",
          "version": "2.0.3"
        }
      }
    ]
  },
  "weaknesses": [
    {
      "source": "[email protected]",
      "type": "Secondary",
      "description": [
        {
          "lang": "en",
          "value": "CWE-22"
        }
      ]
    }
  ],
  "references": [
    {
      "url": "https://github.com/huggingface/transformers/commit/eaaaf8494dd5386634ae37d1d122212fdc315be5",
      "source": "[email protected]"
    },
    {
      "url": "https://huntr.com/bounties/362824d5-fe18-40e8-a6cf-62277f97a170",
      "source": "[email protected]"
    }
  ]
}