{"id":"CVE-2025-2099","aliases":["CVE-2025-2099","GHSA-qq3j-4f4f-9583","PYSEC-2025-40"],"related":[],"kind":"vulnerability","state":"published","title":"Regular Expression Denial of Service (ReDoS) in huggingface/transformers","summary":"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.","summarySource":"cvelist","descriptions":[{"lang":"en","text":"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.","source":"cvelist"},{"lang":"en","text":"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.\n\n**Fix:** released in **4.50.0**, which rewrites the regex to avoid the inefficient pattern. ([GitHub][1])\n\n*   **Affected:** `< 4.50.0`\n*   **Patched:** `4.50.0`","format":"markdown","source":"ghsa"},{"lang":"es","text":"Una vulnerabilidad en la función `preprocess_string()` del módulo `transformers.testing_utils` en huggingface/transformers versión v4.48.3 permite un ataque de denegación de servicio (ReDoS) mediante expresiones regulares. La expresión regular utilizada para procesar bloques de código en cadenas de documentación contiene cuantificadores anidados, lo que provoca un retroceso exponencial al procesar entradas con un gran número de caracteres de nueva línea. Un atacante puede explotar esto proporcionando un payload especialmente manipulado, lo que provoca un alto consumo de CPU y un posible tiempo de inactividad de la aplicación, lo que resulta en un escenario de denegación de servicio (DoS).","source":"nvd"}],"published":"2025-05-19T11:22:36.908Z","modified":"2026-06-17T09:06:19.567Z","severity":{"scorer":"@huntr_ai","scheme":"CVSS:3.0","vector":"CVSS:3.0/AV:N/AC:L/PR:N/UI:N/S:U/C:N/I:N/A:L","score":5.3,"rating":"MEDIUM"},"severities":[{"scorer":"@huntr_ai","scheme":"CVSS:3.0","vector":"CVSS:3.0/AV:N/AC:L/PR:N/UI:N/S:U/C:N/I:N/A:L","score":5.3,"rating":"MEDIUM"},{"scorer":"GitHub","scheme":"CVSS:3.0","vector":"CVSS:3.0/AV:N/AC:L/PR:N/UI:N/S:U/C:N/I:N/A:L","score":5.3,"rating":"MEDIUM"},{"scorer":"NVD","scheme":"CVSS:3.1","vector":"CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:N/I:N/A:H","score":7.5,"rating":"HIGH"},{"scorer":"PyPA Advisory Database","scheme":"CVSS:3.1","vector":"CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:N/I:N/A:H","score":7.5,"rating":"HIGH"}],"cwes":["CWE-1333"],"affected":[{"ranges":[{"type":"custom","introduced":"unspecified","fixed":"4.50.0","status":"affected"}],"vendor":"huggingface","product":"huggingface/transformers","source":"cvelist"},{"ranges":[{"type":"ecosystem","introduced":"0","status":"affected","fixed":"4.50.0"}],"ecosystem":"PyPI","package":"transformers","purl":"pkg:pypi/transformers","source":"ghsa"},{"ranges":[{"status":"affected","lastAffected":"4.48.3"}],"vendor":"huggingface","product":"transformers","cpe":"cpe:2.3:a:huggingface:transformers:*:*:*:*:*:*:*:*","source":"nvd"},{"ranges":[{"type":"git","introduced":"0","status":"affected","fixed":"8cb522b4190bd556ce51be04942720650b1a3e57"},{"type":"ecosystem","introduced":"0","status":"affected","fixed":"4.49.0"}],"ecosystem":"PyPI","package":"transformers","purl":"pkg:pypi/transformers","repo":"https://github.com/huggingface/transformers","source":"pysec"}],"references":[{"url":"https://huntr.com/bounties/97b780f3-ffca-424f-ad5d-0e1c57a5bde4","tags":["evidence","exploit","third-party-advisory","web"],"sources":["cvelist","ghsa","nvd","pysec"]},{"url":"https://github.com/huggingface/transformers/commit/8cb522b4190bd556ce51be04942720650b1a3e57","tags":["fix","patch","web"],"sources":["cvelist","ghsa","nvd","pysec"]},{"url":"https://nvd.nist.gov/vuln/detail/CVE-2025-2099","tags":["advisory"],"sources":["ghsa"]},{"url":"https://github.com/huggingface/transformers/pull/36648","tags":["web"],"sources":["ghsa"]},{"url":"https://github.com/huggingface/transformers","tags":["package"],"sources":["ghsa"]},{"url":"https://github.com/pypa/advisory-database/tree/main/vulns/transformers/PYSEC-2025-40.yaml","tags":["web"],"sources":["ghsa"]},{"url":"https://github.com/advisories/GHSA-qq3j-4f4f-9583","tags":["advisory"],"sources":["pysec"]}],"credits":[],"assigner":"@huntr_ai","ssvc":{"scorer":"CISA-ADP","exploitation":"poc","automatable":"yes","technicalImpact":"partial","date":"2025-05-19T13:38:03.242Z"},"sources":[{"source":"cvelist","name":"CVE List","id":"CVE-2025-2099","url":"https://www.cve.org/CVERecord?id=CVE-2025-2099","licence":"CVE Terms of Use","modified":"2025-05-19T13:45:13.385Z"},{"source":"ghsa","name":"GitHub Advisory Database","id":"GHSA-qq3j-4f4f-9583","url":"https://github.com/advisories/GHSA-qq3j-4f4f-9583","licence":"CC-BY-4.0","modified":"2025-09-25T21:51:20.118Z"},{"source":"nvd","name":"NVD","id":"CVE-2025-2099","url":"https://nvd.nist.gov/vuln/detail/CVE-2025-2099","licence":"Public domain","modified":"2026-06-17T09:06:19.567Z"},{"source":"pysec","name":"PyPA Advisory Database","id":"PYSEC-2025-40","url":"https://osv.dev/vulnerability/PYSEC-2025-40","licence":"CC-BY-4.0","modified":"2026-06-10T17:02:48.111Z"}],"updatedAt":"2026-11-25T22:58:58.213Z","epss":{"score":0.00613,"percentile":0.50713,"date":"2026-12-01T12:00:22.000Z"}}