Skip to content
HighVulnerability

CVE-2025-6921: huggingface/transformers ReDoS in AdamWeightDecay optimizer via regex patterns

Identifier
CVE-2025-6921
Published
Record updated
View JSON
Affected
  • transformers < 4.53.0
Fixed in
4.53.0
  • released June 26, 2025, 89 days before disclosure
Known exploitation
Not listed in the CISA Known Exploited Vulnerabilities catalog at the last check.
EPSS
0.5%

Summary

CVE-2025-6921 affects the huggingface/transformers library before version 4.53.0. Malicious regular expressions in the include_in_weight_decay and exclude_from_weight_decay lists of the AdamWeightDecay optimizer, processed by the _do_use_weight_decay method, can trigger catastrophic backtracking during re.search. An attacker who controls those patterns can drive CPU use to 100%, hanging the machine learning task and making services unresponsive.

Mitigation

The source does not state a fix yet. Check the original advisory for updates.