CVE-2025-2099
HIGH 7.5CVSS 3.1Hugging Face Transformers Regular Expression Denial of Service
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.
- Published
- 19 May 2025
- Last modified
- 17 Jun 2026
- Assigned by
- security@huntr.dev
- NVD status
- Analyzed
- Weakness
- CWE-1333
- Also known as
- GHSA-qq3j-4f4f-9583PYSEC-2025-40
- Sources
- NVDJSONOSV GHSA-qq3j-4f4f-9583JSONOSV PYSEC-2025-40JSON
Scores
| Source | Scored by | Version | Score | Vector / decision |
|---|---|---|---|---|
| NVD | nvd@nist.gov (Primary) | CVSS 3.1 | HIGH 7.5 | CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:N/I:N/A:H |
| OSV | PyPA | CVSS 3.1 | HIGH 7.5 | CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:N/I:N/A:H |
| NVD | security@huntr.dev (Secondary) | CVSS 3.0 | MEDIUM 5.3 | CVSS:3.0/AV:N/AC:L/PR:N/UI:N/S:U/C:N/I:N/A:L |
| OSV | GitHub | CVSS 3.0 | MEDIUM 5.3 | CVSS:3.0/AV:N/AC:L/PR:N/UI:N/S:U/C:N/I:N/A:L |
Affected
| Source | Vendor / ecosystem | Product / package | Affected versions | Fixed in |
|---|---|---|---|---|
| NVD | huggingface | transformerscpe:2.3:a:huggingface:transformers:*:*:*:*:*:*:*:* |
<= 4.48.3 | |
| OSV | PyPI | transformers | < 4.50.0 | 4.50.0 |
| OSV | PyPI | transformers | < 4.49.0 | 4.49.0 |
References
- https://github.com/huggingface/transformers/commit/8cb522b4190bd556ce51be04942720650b1a3e57 · Patch, WEB, FIX
- https://huntr.com/bounties/97b780f3-ffca-424f-ad5d-0e1c57a5bde4 · Exploit, Third Party Advisory, WEB, EVIDENCE
- 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
History
- 25 Nov 2026 20:58 UTC · NVD: first stored (published 19 May 2025)
- 25 Nov 2026 20:12 UTC · OSV: first stored (published 19 May 2025)
- 25 Nov 2026 20:12 UTC · OSV: first stored (published 19 May 2025)