# CVE-2025-2099: Regular Expression Denial of Service (ReDoS) in huggingface/transformers

- Severity: Medium 5.3 (CVSS:3.0, scored by @huntr_ai) `CVSS:3.0/AV:N/AC:L/PR:N/UI:N/S:U/C:N/I:N/A:L`
- Known to be exploited: not in CISA's catalogue, which lists only what CISA has confirmed
- Likelihood of exploitation in the next 30 days (EPSS): 0.61%, higher than 50% of CVEs (2026-12-01)
- Public exploit code or proof of concept: one link below, marked "exploit"
- Published: 2025-05-19T11:22:36.908Z
- Modified: 2026-06-17T09:06:19.567Z
- Also known as: GHSA-qq3j-4f4f-9583, PYSEC-2025-40
- Weaknesses: CWE-1333
- SSVC (CISA-ADP): exploitation poc, automatable yes, technical impact partial
- Assigned by: @huntr_ai

## 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.

(As written by CVE List.)

## Affected

- huggingface huggingface/transformers: from unspecified before 4.50.0
- transformers (PyPI): before 4.50.0; before 8cb522b4190bd556ce51be04942720650b1a3e57; before 4.49.0
- huggingface transformers: up to 4.48.3

## Every score

- @huntr_ai: CVSS:3.0 5.3 Medium `CVSS:3.0/AV:N/AC:L/PR:N/UI:N/S:U/C:N/I:N/A:L`
- GitHub: CVSS:3.0 5.3 Medium `CVSS:3.0/AV:N/AC:L/PR:N/UI:N/S:U/C:N/I:N/A:L`
- NVD: CVSS:3.1 7.5 High `CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:N/I:N/A:H`
- PyPA Advisory Database: CVSS:3.1 7.5 High `CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:N/I:N/A:H`

## References

- <https://huntr.com/bounties/97b780f3-ffca-424f-ad5d-0e1c57a5bde4> (exploit, evidence, third-party-advisory, web)
- <https://github.com/huggingface/transformers/commit/8cb522b4190bd556ce51be04942720650b1a3e57> (fix, patch, web)
- <https://nvd.nist.gov/vuln/detail/CVE-2025-2099> (advisory)
- <https://github.com/huggingface/transformers/pull/36648> (web)
- <https://github.com/huggingface/transformers> (package)
- <https://github.com/pypa/advisory-database/tree/main/vulns/transformers/PYSEC-2025-40.yaml> (web)
- <https://github.com/advisories/GHSA-qq3j-4f4f-9583> (advisory)

## Sources

- CVE List: [CVE-2025-2099](https://www.cve.org/CVERecord?id=CVE-2025-2099), CVE Terms of Use, modified 2025-05-19
- GitHub Advisory Database: [GHSA-qq3j-4f4f-9583](https://github.com/advisories/GHSA-qq3j-4f4f-9583), CC-BY-4.0, modified 2025-09-25
- NVD: [CVE-2025-2099](https://nvd.nist.gov/vuln/detail/CVE-2025-2099), Public domain, modified 2026-06-17
- PyPA Advisory Database: [PYSEC-2025-40](https://osv.dev/vulnerability/PYSEC-2025-40), CC-BY-4.0, modified 2026-06-10

---

Page: https://cve.day/CVE-2025-2099 · Whole record: https://cve.day/CVE-2025-2099.json · Rebuilt by cve.day 2026-11-25T22:58:58.213Z
