CVE-2025-6921
JSON

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 packageVersionsReported by
huggingface huggingface/transformersfrom unspecified before 4.53.0CVE List
transformers (PyPI)before 4.53.0GitHub Advisory Database, PyPA Advisory Database
huggingface transformersbefore 4.53.0NVD

All scores

@huntr_ai5.3medium CVSS:3.0CVSS:3.0/AV:N/AC:L/PR:N/UI:N/S:U/C:N/I:N/A:L
GitHub5.3medium CVSS:3.0CVSS:3.0/AV:N/AC:L/PR:N/UI:N/S:U/C:N/I:N/A:L
NVD7.5high CVSS:3.1CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:N/I:N/A:H
PyPA Advisory Database5.3medium CVSS:3.0CVSS:3.0/AV:N/AC:L/PR:N/UI:N/S:U/C:N/I:N/A:L

Classification

CWE-400

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

SourceRecordLicence
CVE ListCVE-2025-6921 changed 2025-09-23CVE Terms of Use
GitHub Advisory DatabaseGHSA-4w7r-h757-3r74 changed 2026-09-10CC-BY-4.0
NVDCVE-2025-6921 changed 2026-10-11Public domain
PyPA Advisory DatabasePYSEC-2026-1980 changed 2026-07-07CC-BY-4.0