Regular Expression Denial of Service in Hugging Face Transformers Library
CVE-2025-6921

5.3MEDIUM

Key Information:

Vendor
CVE Published:
23 September 2025

What is CVE-2025-6921?

The Hugging Face Transformers library prior to version 4.53.0 is susceptible to a Regular Expression Denial of Service (ReDoS) vulnerability within its AdamWeightDecay optimizer. This issue is triggered by the _do_use_weight_decay method, which improperly processes user-controlled regular expressions in specified lists. Attackers can exploit this vulnerability by inserting malicious regular expressions, resulting in catastrophic backtracking during the re.search operation. The exploitation can lead to excessive CPU utilization, causing system hangs and unresponsiveness during machine learning tasks, ultimately affecting service availability.

Affected Version(s)

huggingface/transformers < 4.53.0

References

CVSS V3.0

Score:
5.3
Severity:
MEDIUM
Confidentiality:
None
Integrity:
None
Availability:
None
Attack Vector:
Network
Attack Complexity:
Low
Privileges Required:
None
User Interaction:
None
Scope:
Unchanged

Timeline

  • Vulnerability published

  • Vulnerability Reserved

.
CVE-2025-6921 : Regular Expression Denial of Service in Hugging Face Transformers Library