CVE-2026-9856
Description
A flaw was found in Hugging Face Transformers. An attacker can exploit a path traversal vulnerability in the save_pretrained() methods of PreTrainedTokenizerBase and ProcessorMixin by publishing a malicious Hugging Face Hub repository. When a victim downloads and saves a tokenizer or processor, attacker-controlled keys in the chat_template dictionary can lead to arbitrary file writes outside the intended save directory. This could allow an attacker to write malicious files to arbitrary locations on a user's system.
Statement
This vulnerability is rated as Important severity because successful exploitation allows path traversal leading to arbitrary file modification with the privileges of the executing process, potentially enabling code execution. Although exploitation requires user interaction to download and serialize an untrusted repository, the high integrity impact of unrestricted filesystem writes elevates the risk above Moderate. In typical Red Hat deployments such as AI/ML pipelines and model-serving environments, exposure occurs when applications ingest and save untrusted community models. Workloads running in isolated containers or under restricted service accounts limit the blast radius of any resulting directory escape.
Understanding the Weakness (CWE)
Integrity,Confidentiality,Availability
Technical Impact: Execute Unauthorized Code or Commands
The attacker may be able to create or overwrite critical files that are used to execute code, such as programs or libraries.
Integrity
Technical Impact: Modify Files or Directories
The attacker may be able to overwrite or create critical files, such as programs, libraries, or important data. If the targeted file is used for a security mechanism, then the attacker may be able to bypass that mechanism. For example, appending a new account at the end of a password file may allow an attacker to bypass authentication.
Confidentiality
Technical Impact: Read Files or Directories
The attacker may be able to read the contents of unexpected files and expose sensitive data. If the targeted file is used for a security mechanism, then the attacker may be able to bypass that mechanism. For example, by reading a password file, the attacker could conduct brute force password guessing attacks in order to break into an account on the system.
Availability
Technical Impact: DoS: Crash, Exit, or Restart
The attacker may be able to overwrite, delete, or corrupt unexpected critical files such as programs, libraries, or important data. This may prevent the product from working at all and in the case of protection mechanisms such as authentication, it has the potential to lock out product users.
Frequently Asked Questions
Not sure what something means? Check out our Security Glossary.
Want to get errata notifications? Sign up here.