transformers
Affected
- introduced
0, fixed4.50.0(ecosystem)
Fixed versions
4.50.0
Fix
- Fixed version
4.50.0pip install --upgrade transformers==4.50.0
Advisory
Also known as: CVE-2025-2099, PYSEC-2025-40
Hugging Face Transformers Regular Expression Denial of Service
A Regular Expression Denial of Service (ReDoS) exists in the preprocess_string() function of the transformers.testing_utils module. In versions before 4.50.0, the regex used to process code blocks in docstrings contains nested quantifiers that can trigger catastrophic backtracking when given inputs with many newline characters. An attacker who can supply such input to preprocess_string() (or code paths that call it) can force excessive CPU usage and degrade availability.
Fix: released in 4.50.0, which rewrites the regex to avoid the inefficient pattern. ([GitHub][1])
< 4.50.04.50.0Medium Basis: The source's own band: MODERATE
0, fixed 4.50.0 (ecosystem)4.50.0
4.50.0pip install --upgrade transformers==4.50.0Fix commands are the export's own generic commands. Ojuju never runs them. Check them against your setup first.
Check your own computer: guard packages check
Source: GitHub Advisory Database (reviewed advisories) · CC BY 4.0