Intel

AIKIDO-2026-295187

transformers is vulnerable to Path Traversal

Path Traversal Pre-CVE
Found by Aikido Intel before public disclosure or CVE publication.
Published 5 days ago

65

Medium Risk

This Affects:

PYTHONtransformers
2.0.0 - 5.12.1
Fixed in 5.13.0
Are you affected? Scan for Free

TL;DR

The tokenizer loading path in transformers reads vocab-file arguments such as vocab_file and merges_file from the untrusted tokenizer_config.json and lets those values take precedence over the repository-resolved paths. When an application loads a tokenizer from an attacker-controlled repository with AutoTokenizer.from_pretrained, a crafted absolute path or a path containing .. is opened verbatim, allowing arbitrary local files outside the repository to be read into the tokenizer. This works even when trust_remote_code is disabled, and the read content can be exfiltrated through save and push-to-hub workflows. The fix makes the repository-resolved path take precedence so only an explicit caller-provided path can override it.

Who does this affect?

You are affected if you are using a version that falls within the vulnerable range and you load tokenizers from untrusted or externally supplied model repositories.

Background info

transformers is vulnerable to Path Traversal in versions 2.0.0 - 5.12.1.

How to fix this

Upgrade the transformers library to the patch version.