{"cve":"CVE-2025-6921","nvd":{"published":"2025-09-23T14:15:41.387","modified":"2026-10-11T20:10:00.200","status":"Analyzed","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.","cvss_v4":null,"cvss_v3":{"version":"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},"cwes":["CWE-400"],"references":["https://github.com/huggingface/transformers/commit/47c34fba5c303576560cb29767efb452ff12b8be","https://huntr.com/bounties/287d15a7-6e7c-45d2-8c05-11e305776f1f"],"products":["huggingface:transformers"],"source":"nvd","synced_at":"2026-10-19T22:10:08.713834912+00:00"},"epss":{"cve":"CVE-2025-6921","score":0.00511,"percentile":0.43281,"date":"2026-10-25"},"kev":null,"osv":[{"id":"GHSA-4w7r-h757-3r74","url":"https://osv.dev/vulnerability/GHSA-4w7r-h757-3r74","summary":"Hugging Face Transformers vulnerable to Regular Expression Denial of Service (ReDoS) in the AdamWeightDecay optimizer","modified":"2026-09-10T03:50:27.867584538Z","packages":[{"ecosystem":"PyPI","name":"transformers","purl":"pkg:pypi/transformers","ranges":["<4.53.0"],"fixed":["4.53.0"]}]},{"id":"PYSEC-2026-1980","url":"https://osv.dev/vulnerability/PYSEC-2026-1980","summary":"Hugging Face Transformers vulnerable to Regular Expression Denial of Service (ReDoS) in the AdamWeightDecay optimizer","modified":"2026-07-07T17:48:13.614617956Z","packages":[{"ecosystem":"PyPI","name":"transformers","purl":"pkg:pypi/transformers","ranges":["<4.53.0"],"fixed":["4.53.0"]}]}],"attribution":["This product uses the NVD API but is not endorsed or certified by the NVD.","EPSS scores: FIRST Exploit Prediction Scoring System, https://www.first.org/epss","Known exploited vulnerabilities: CISA Known Exploited Vulnerabilities Catalog, https://www.cisa.gov/known-exploited-vulnerabilities-catalog","Package advisories: OSV (https://osv.dev), from the GitHub Advisory Database, PyPA, Go, RustSec and other ecosystem databases, under CC-BY 4.0 or CC0","CVE records: the CVE Program's CVE List (https://www.cve.org), under its terms of use (https://www.cve.org/Legal/TermsOfUse). CVE is a registered trademark of The MITRE Corporation; this product is not affiliated with the CVE Program."]}