CVE-2025-1194: Transformers Library Regular Expression Denial of Service Vulnerability

transformers Updated 02 Oct 2025

Summary

29/04/2025
Yes i
Moderate
4.3

CVE-2025-1194: Transformers Regular Expression Denial of Service (ReDoS) vulnerability. Affects transformers versions < 4.50.0. Fixed in 4.50.0. How to fix ↓

Free scan

Check if this vulnerability affects your application

Upload a manifest or SBOM and we'll show whether you're affected, plus every other risky package in the same scan.

Check my app free

No signup required · Results in about 60 seconds

Upload your dependency manifest or SBOM

Drag & drop your file here or

Java Javascript PHP Python Go Rust Ruby Dart C/C++ Elixir CycloneDX SPDX

Upload a supported dependency manifest or SBOM. No installation or source-code access required.

See supported files and SBOM formats
SBOM sbom.json · bom.json · bom.xml · *.spdx.json · *.cdx.json · *.cdx.xml
Java pom.xml · gradle.lockfile · buildscript-gradle.lockfile
Javascript package-lock.json · yarn.lock · pnpm-lock.yaml
PHP composer.lock
Python poetry.lock · requirements.txt · Pipfile.lock
Go go.mod
Rust Cargo.lock
Ruby Gemfile.lock
Dart pubspec.lock
C/C++ conan.lock
Elixir mix.lock
Enter your work email to receive your report link.

Verify your email to view the full report and start 30 days of continuous monitoring. No credit card required.

Sponsored Devnack Your last release was probably never penetration tested Manual testing by engineers who build software, not an auditor's checklist. Trusted by teams at Swift and Google Talk to Devnack

Background

The transformers library, developed by Hugging Face, is a popular open-source library used for natural language processing tasks. It provides pre-trained models and tools for tasks such as text generation, translation, and sentiment analysis. The library is widely utilized in various applications due to its ease of use and extensive model support. However, a vulnerability has been identified in the tokenization process of the GPT-NeoX-Japanese model, which can lead to performance issues under certain conditions.

Vulnerability Detail

A Regular Expression Denial of Service (ReDoS) vulnerability exists in the SubWordJapaneseTokenizer class of the huggingface/transformers library. This vulnerability arises from a regular expression that exhibits exponential complexity when processing specially crafted inputs. The excessive backtracking caused by this regex can lead to high CPU usage, potentially resulting in application downtime and a Denial of Service (DoS) scenario. The affected version is v4.48.1, and the issue is documented under CVE-2025-1194.

How To Fix

Latest published version: 5.20.2 as of 22 Oct 2026

pip install --upgrade "transformers==5.20.2"

Upgrading to it may include breaking changes; the version below is the minimum fixed release for this vulnerability.

If you need the minimum change

4.50.0

This is the first release that contains the fix.

pip install --upgrade "transformers==4.50.0"

Tip — Not sure which version your app runs? Vulert can match this fix to it. Scan free →

Workaround

As a temporary workaround, you can avoid using the SubWordJapaneseTokenizer class for tokenization tasks until you can update to the patched version. Additionally, consider validating inputs to ensure they do not trigger the vulnerable regex.

Conclusion

The identified ReDoS vulnerability in the huggingface/transformers library poses a moderate risk to applications utilizing the affected version. It is crucial to update to version 4.50.0 or later to ensure the security and performance of your application. Utilizing tools like Vulert can help monitor for such vulnerabilities in real-time.

See every vulnerability recorded for transformers →

Share this vulnerability

FAQ

ReDoS is a type of denial of service attack that exploits the way regular expressions are processed, leading to excessive resource consumption and potential application downtime.

The vulnerability affects version 4.48.1 of the transformers library. It is recommended to upgrade to version 4.50.0 or later to mitigate the issue.

You can use the Vulert platform to monitor and alert for open-source vulnerabilities in your software. Visit Vulert Scanner to check if your application is affected without requiring any signup.

If exploited, this vulnerability can lead to high CPU usage, application slowdowns, and potential downtime, impacting the availability of your application.

Yes, as a temporary measure, you can avoid using the SubWordJapaneseTokenizer class and validate inputs to prevent triggering the vulnerable regex.

Related vulnerabilities

Recent vulnerabilities recorded for transformers.

How To Fix

Latest published version: 5.20.2 as of 22 Oct 2026

pip install --upgrade "transformers==5.20.2"

Upgrading to it may include breaking changes; the version below is the minimum fixed release for this vulnerability.

If you need the minimum change

4.50.0

This is the first release that contains the fix.

pip install --upgrade "transformers==4.50.0"

Tip — Not sure which version your app runs? Vulert can match this fix to it. Scan free →

Subscribe to Vulert on Telegram
Daily digest of new CVEs, critical and high severity, affected packages and fixes — plus a weekly roundup.
Join the channel →
Help improve this record
Report an issue or send feedback