CVE-2025-3263: Transformers Library ReDoS Vulnerability in get_configuration_file Function
Summary
CVE-2025-3263: Transformers's ReDoS vulnerability in get_configuration_file can lead to catastrophic backtracking. Affects transformers versions < 4.51.0. Fixed in 4.51.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 Hugging Face Transformers library is a widely used open-source library that provides state-of-the-art machine learning models for natural language processing tasks. It allows users to easily implement and fine-tune models for various applications, making it a popular choice among developers and researchers. However, version 4.49.0 of this library has a vulnerability that can lead to performance issues due to a Regular Expression Denial of Service (ReDoS) attack.
Vulnerability Detail
A Regular Expression Denial of Service (ReDoS) vulnerability exists in the get_configuration_file() function of the Transformers library. This vulnerability is caused by a poorly constructed regular expression pattern config\.(.*)\.json, which can be exploited by providing specially crafted input strings. When triggered, this can lead to excessive CPU consumption, resulting in model serving disruptions, resource exhaustion, and increased latency in applications that utilize the library.
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.51.0
This is the first release that contains the fix.
pip install --upgrade "transformers==4.51.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 get_configuration_file() function with potentially malicious input. Additionally, consider implementing input validation to prevent the use of crafted strings that could exploit the vulnerability.
Conclusion
The ReDoS vulnerability in the Hugging Face Transformers library's get_configuration_file() function poses a risk of performance degradation and service disruption. It is crucial to update to version 4.51.0 or later to mitigate this risk. Additionally, utilizing tools like Vulert can help monitor and alert for such vulnerabilities in real-time.
See every vulnerability recorded for transformers →
FAQ
A ReDoS vulnerability occurs when a regular expression can be exploited to cause excessive backtracking, leading to high CPU usage and potential denial of service.
Version 4.49.0 of the Transformers library is affected by this vulnerability.
You can use the Vulert playground at Vulert Scanner to check if your application is affected by this vulnerability without needing to sign up.
If you cannot update the library immediately, implement input validation to prevent the use of crafted strings that could exploit the vulnerability.
The CVSS score of this vulnerability is 5.3, indicating a moderate severity level.
References
Related vulnerabilities
Recent vulnerabilities recorded for transformers.