CVE-2025-6921 Details
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.
A Regular Expression Denial-of-Service (ReDoS) vulnerability has been identified in the Hugging Face Transformers library, specifically in versions prior to 4.53.0. The issue resides within the AdamWeightDecay optimizer, where the '_do_use_weight_decay' method processes user-controlled regular expressions from 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 excessive CPU utilization and a denial-of-service condition. This vulnerability can be exploited by attackers who manipulate the regex patterns, causing machine learning tasks to hang and disrupting service availability.
Users can upgrade to Hugging Face Transformers version 4.53.0 or later, where this vulnerability has been fixed.
Metrics
CVSS 4.0 Severity and Vector Strings:
No CVSS 4.0 data is available for this CVE.
CVSS 3.x Severity and Vector Strings:
No data available for CVSS Version 2.0 on this CVE.
CISA-ADP
Assessed Sep 23, 2025References to Advisories, Solutions, and Tools
By selecting these links, you will be leaving this site. These are references gathered from the official CVE record and are not endorsed by Volerion.
| URL | Source(s) | Tag(s) |
|---|---|---|
| https://github.com/huggingface/transformers/commit/47c34fba5c303576560cb29767efb452ff12b8be | [email protected] | Patch |
| https://huntr.com/bounties/287d15a7-6e7c-45d2-8c05-11e305776f1f | [email protected] | ExploitThird Party Advisory |
Weakness Enumeration
| CWE-ID | CWE Name | Source |
|---|---|---|
| CWE-400 | Uncontrolled Resource Consumption | [email protected] |
Affected Products
| Product | Versions |
|---|---|
| huggingface transformers | < 4.53.0 |
CPE
Remediation
| |
Change History
5 change records found show changes
| Date | Action | Recorded By |
|---|---|---|
| Oct 11, 2026 | CVE Translated | [email protected] |
| Jun 17, 2026 | CVE Modified | [email protected] |
| Jun 17, 2026 | CVE Modified | CISA-ADP |
| Oct 10, 2025 | Initial Analysis | [email protected] |
| Sep 23, 2025 | New CVE Received | [email protected] |