Advisory

GHSA-qq3j-4f4f-9583

Also known as: CVE-2025-2099, PYSEC-2025-40

Summary

Hugging Face Transformers Regular Expression Denial of Service

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

  • Affected: < 4.50.0
  • Patched: 4.50.0

Severity

Medium Basis: The source's own band: MODERATE

Dates

Published
2025-05-19 12:30 UTC
Modified
2025-09-25 21:51 UTC

Affected packages and fixes

transformers

PyPI · All systems

Affected

  • introduced 0, fixed 4.50.0 (ecosystem)

Fixed versions

4.50.0

Fix

  • Fixed version 4.50.0
    pip install --upgrade transformers==4.50.0

Fix 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

View this record on OSV.dev

Source

Source: GitHub Advisory Database (reviewed advisories) · CC BY 4.0

Sources & licences