INCIDENT MAP

Browse / AI Framework and Platform Flaws / CVE-2025-2099

Hugging Face Transformers Regular Expression Denial of Service

CVE-2025-2099 ยท 2025-05-19 moderate

Class
AI Framework and Platform Flaws (filed by a model that read the advisory)
Technique
Denial of service
Affected
transformers (PyPI)
CVSS
CVSS:3.0/AV:N/AC:L/PR:N/UI:N/S:U/C:N/I:N/A:L
EPSS
0.6% chance of exploitation in 30 days

How it works, in short

Nested quantifiers in a docstring code-block regex cause catastrophic backtracking on inputs with many newlines, consuming CPU. (Our summary, written by a model. The source text is below.)

Details

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])

References

Source: GitHub Advisory Database, used under CC BY 4.0.