transformers is vulnerable to Regular Expression Denial of Service (ReDoS)
53
Medium Risk
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.
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.
transformers is vulnerable to Regular Expression Denial of Service (ReDoS) in versions 5.0.0 - 5.14.1.
Upgrade the transformers library to the patch version.
Connect your repositories to instantly see whether vulnerable or malicious packages exist in your codebase.
Free. No credit card required.

I consent to receiving marketing communications based on Aikido’s Privacy Policy.
SOC 2Compliant
ISO 27001Compliant