Intel

AIKIDO-2026-391542

transformers is vulnerable to Regular Expression Denial of Service (ReDoS)

Regular Expression Denial of Service (ReDoS) Pre-CVE
Found by Aikido Intel before public disclosure or CVE publication.
Published 3 days ago

53

Medium Risk

This Affects:

PYTHONtransformers
5.0.0 - 5.14.1
Fixed in 5.15.0
Are you affected? Scan for Free

TL;DR

The tokenizer loading path in from_pretrained takes a tokenizer filename from a model repository and uses it directly as a regular-expression pattern. When the filename contains crafted regex metacharacters, matching it against the repository file list triggers catastrophic backtracking. Loading a tokenizer from a malicious or user-controlled repository can hang the process and exhaust CPU, causing denial of service. The fix replaces the regex match with a plain substring membership check.

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 user-controlled model repositories.

Background info

transformers is vulnerable to Regular Expression Denial of Service (ReDoS) in versions 5.0.0 - 5.14.1.

How to fix this

Upgrade the transformers library to the patch version.