5.3medium
Regular Expression Denial of Service (ReDoS) in huggingface/transformers
- Severity
- 5.3medium CVSS:3.0 by @huntr_ai
- Exploit likelihood
- 0.54% (higher than 46% of CVEs; EPSS, by FIRST)
- Published
- Last changed
- Assigned by
- @huntr_ai
- Also known as
- GHSA-4w7r-h757-3r74PYSEC-2026-1980
Description
The huggingface/transformers library, versions prior to 4.53.0, is vulnerable to Regular Expression Denial of Service (ReDoS) in the AdamWeightDecay optimizer. The vulnerability arises from the _do_use_weight_decay method, which processes user-controlled regular expressions in the include_in_weight_decay and exclude_from_weight_decay lists. Malicious regular expressions can cause catastrophic backtracking during the re.search call, leading to 100% CPU utilization and a denial of service. This issue can be exploited by attackers who can control the patterns in these lists, potentially causing the machine learning task to hang and rendering services unresponsive.
Affected
| Product or package | Versions | Reported by |
|---|---|---|
| huggingface huggingface/transformers | from unspecified before 4.53.0 | CVE List |
| transformers (PyPI) | before 4.53.0 | GitHub Advisory Database, PyPA Advisory Database |
| huggingface transformers | before 4.53.0 | NVD |
All scores
| @huntr_ai | 5.3medium CVSS:3.0 | CVSS:3.0/AV:N/AC:L/PR:N/UI:N/S:U/C:N/I:N/A:L |
| GitHub | 5.3medium CVSS:3.0 | CVSS:3.0/AV:N/AC:L/PR:N/UI:N/S:U/C:N/I:N/A:L |
| NVD | 7.5high CVSS:3.1 | CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:N/I:N/A:H |
| PyPA Advisory Database | 5.3medium CVSS:3.0 | CVSS:3.0/AV:N/AC:L/PR:N/UI:N/S:U/C:N/I:N/A:L |
Classification
SSVC (CISA-ADP): exploitation poc, automatable yes, technical impact partial.
What each source says
CVE List
The huggingface/transformers library, versions prior to 4.53.0, is vulnerable to Regular Expression Denial of Service (ReDoS) in the AdamWeightDecay optimizer. The vulnerability arises from the _do_use_weight_decay method, which processes user-controlled regular expressions in the include_in_weight_decay and exclude_from_weight_decay lists. Malicious regular expressions can cause catastrophic backtracking during the re.search call, leading to 100% CPU utilization and a denial of service. This issue can be exploited by attackers who can control the patterns in these lists, potentially causing the machine learning task to hang and rendering services unresponsive.
NVD (es)
La biblioteca huggingface/transformers, versiones anteriores a la 4.53.0, es vulnerable a la Denegación de Servicio por Expresiones Regulares (ReDoS) en el optimizador AdamWeightDecay. La vulnerabilidad surge del método _do_use_weight_decay, que procesa expresiones regulares controladas por el usuario en las listas include_in_weight_decay y exclude_from_weight_decay. Expresiones regulares maliciosas pueden causar un retroceso catastrófico durante la llamada a re.search, lo que lleva a una utilización del 100% de la CPU y una denegación de servicio. Este problema puede ser explotado por atacantes que pueden controlar los patrones en estas listas, lo que podría causar que la tarea de aprendizaje automático se cuelgue y dejar los servicios sin respuesta.
References
Sources
| Source | Record | Licence |
|---|---|---|
| CVE List | CVE-2025-6921 changed 2025-09-23 | CVE Terms of Use |
| GitHub Advisory Database | GHSA-4w7r-h757-3r74 changed 2026-09-10 | CC-BY-4.0 |
| NVD | CVE-2025-6921 changed 2026-10-11 | Public domain |
| PyPA Advisory Database | PYSEC-2026-1980 changed 2026-07-07 | CC-BY-4.0 |