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

- Severity: Medium 5.3 (CVSS:3.0, scored by @huntr_ai) `CVSS:3.0/AV:N/AC:L/PR:N/UI:N/S:U/C:N/I:N/A:L`
- Known to be exploited: not in CISA's catalogue, which lists only what CISA has confirmed
- Likelihood of exploitation in the next 30 days (EPSS): 0.54%, higher than 46% of CVEs (2026-12-01)
- Public exploit code or proof of concept: one link below, marked "exploit"
- Published: 2025-09-23T13:56:15.636Z
- Modified: 2026-10-11T20:10:00.200Z
- Also known as: GHSA-4w7r-h757-3r74, PYSEC-2026-1980
- Weaknesses: CWE-400
- SSVC (CISA-ADP): exploitation poc, automatable yes, technical impact partial
- Assigned by: @huntr_ai

## 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.

(As written by CVE List.)

## Affected

- huggingface huggingface/transformers: from unspecified before 4.53.0
- transformers (PyPI): before 4.53.0
- huggingface transformers: before 4.53.0

## Every score

- @huntr_ai: CVSS:3.0 5.3 Medium `CVSS:3.0/AV:N/AC:L/PR:N/UI:N/S:U/C:N/I:N/A:L`
- GitHub: CVSS:3.0 5.3 Medium `CVSS:3.0/AV:N/AC:L/PR:N/UI:N/S:U/C:N/I:N/A:L`
- NVD: CVSS:3.1 7.5 High `CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:N/I:N/A:H`
- PyPA Advisory Database: CVSS:3.0 5.3 Medium `CVSS:3.0/AV:N/AC:L/PR:N/UI:N/S:U/C:N/I:N/A:L`

## References

- <https://huntr.com/bounties/287d15a7-6e7c-45d2-8c05-11e305776f1f> (exploit, third-party-advisory, web)
- <https://github.com/huggingface/transformers/commit/47c34fba5c303576560cb29767efb452ff12b8be> (patch, web)
- <https://nvd.nist.gov/vuln/detail/CVE-2025-6921> (advisory)
- <https://github.com/huggingface/transformers/commit/d37f7517972f67e3f2194c000ed0f87f064e5099> (web)
- <https://github.com/huggingface/transformers> (package)
- <https://pypi.org/project/transformers> (package)
- <https://github.com/advisories/GHSA-4w7r-h757-3r74> (advisory)

## Sources

- CVE List: [CVE-2025-6921](https://www.cve.org/CVERecord?id=CVE-2025-6921), CVE Terms of Use, modified 2025-09-23
- GitHub Advisory Database: [GHSA-4w7r-h757-3r74](https://github.com/advisories/GHSA-4w7r-h757-3r74), CC-BY-4.0, modified 2026-09-10
- NVD: [CVE-2025-6921](https://nvd.nist.gov/vuln/detail/CVE-2025-6921), Public domain, modified 2026-10-11
- PyPA Advisory Database: [PYSEC-2026-1980](https://osv.dev/vulnerability/PYSEC-2026-1980), CC-BY-4.0, modified 2026-07-07

---

Page: https://cve.day/CVE-2025-6921 · Whole record: https://cve.day/CVE-2025-6921.json · Rebuilt by cve.day 2026-11-25T22:59:05.046Z
