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

> CVE-2025-6921: Regular Expression Denial of Service (ReDoS) in huggingface/transformers. CVSS 5.3 (CVSS 3.1).

Canonical: https://rewindex.com/cve/CVE-2025-6921
Last updated: 2026-10-11T20:10:00Z

- Published: 2025-09-23 13:56 UTC · Updated: 2026-10-11 20:10 UTC · Assigner: @huntr\_ai
- CVSS: 5.3 (CVSS 3.1) · Severity: Medium · Vector: CVSS:3.0/AV:N/AC:L/PR:N/UI:N/S:U/C:N/I:N/A:L
- EPSS: 0.51%, 43th percentile (scored 2026-10-25)
- CISA KEV: no
- CWE: CWE-400

## 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 vendors and products

- huggingface: huggingface/transformers

## Tracked companies

- [Hugging Face](https://rewindex.com/company/hugging-face.md)

## References

- [CVE record on cve.org](https://www.cve.org/CVERecord?id=CVE-2025-6921)
- [NVD entry](https://nvd.nist.gov/vuln/detail/CVE-2025-6921)
- [https://github.com/huggingface/transformers/commit/47c34fba5c303576560cb29767efb452ff12b8be](https://github.com/huggingface/transformers/commit/47c34fba5c303576560cb29767efb452ff12b8be)
- [https://huntr.com/bounties/287d15a7-6e7c-45d2-8c05-11e305776f1f](https://huntr.com/bounties/287d15a7-6e7c-45d2-8c05-11e305776f1f)

---

_Sources: CVE records from the CVE Program (cve.org). CVE® is a registered trademark of The MITRE Corporation. (https://www.cve.org/) This product uses data from the NVD API but is not endorsed or certified by the NVD. (https://nvd.nist.gov/) Known Exploited Vulnerabilities catalog from CISA. (https://www.cisa.gov/known-exploited-vulnerabilities-catalog) EPSS scores from FIRST (Exploit Prediction Scoring System). (https://www.first.org/epss/)_


---
Canonical: https://rewindex.com/cve/CVE-2025-6921 · Markdown: https://rewindex.com/cve/CVE-2025-6921.md · JSON: https://rewindex.com/api/v1/cves/CVE-2025-6921 · Data licensed CC BY 4.0 (https://creativecommons.org/licenses/by/4.0/) · Generated 2026-10-26T02:15:13.852Z
