CVE-2025-1194: Transformers Library Regular Expression Denial of Service Vulnerability
Summary
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 ↓
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.
No signup required · Results in about 60 seconds
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 →
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.