CVE-2025-2099

High

Description

A vulnerability in the `preprocess_string()` function of the `transformers.testing_utils` module in huggingface/transformers version v4.48.3 allows for a Regular Expression Denial of Service (ReDoS) attack. The regular expression used to process code blocks in docstrings contains nested quantifiers, leading to exponential backtracking when processing input with a large number of newline characters. An attacker can exploit this by providing a specially crafted payload, causing high CPU usage and potential application downtime, effectively resulting in a Denial of Service (DoS) scenario.

SeverityHigh
CVSS7.5
Exploit probability—
ProductHuggingface Transformers
PublishedMay 19, 2025
First seenMay 19, 2025
Weakness typeCWE-1333CWE-1333

How to fix

Update
  • transformers4.50.0, 4.49.0 or later

Affected products

ProductAffected versionsFixed in
huggingface transformersv ≤ 4.48.3—
transformersPyPIv < 4.50.0, v < 4.49.04.50.0, 4.49.0

Check your version

Choose the product and enter the version you run to see whether it falls in the affected range.

In the Intelligence 360 plan

Attack Surface Management

See the assets tied to your domains, the technologies they run and known vulnerabilities in one list.