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

Published Sep 23, 2025
·
Updated

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 douseweightdecay method, which processes user-controlled regular expressions in the includeinweightdecay and excludefromweightdecay 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.

Affected Software

3 affected componentsFixes available
Hugging Face Transformers<4.53.0
pip/transformers<4.53.0
4.53.0
huggingface transformers<4.53.0

Event History

Sep 23, 2025
CVE Published
via MITRE·01:56 PM
Data Sourced
via MITRE·01:56 PM
DescriptionSeverityWeakness
Data Sourced
via NVD·02:15 PM
DescriptionSeverityWeakness
Data Sourced
via NVD·02:15 PM
RemedyAffected Software
Advisory Published
via GitHub·03:31 PM
Data Sourced
via GitHub·03:31 PM
DescriptionSeverityWeaknessAffected Software
Free Weekly Intel

Don't miss critical vulnerabilities

Join thousands of security professionals who receive our weekly digest of trending CVEs, zero-days, and exploited vulnerabilities.

No spam. Unsubscribe anytime.

Frequently Asked Questions

1

What is the severity of CVE-2025-6921?

CVE-2025-6921 has been classified as a severity level that poses a risk of denial of service due to regular expression processing.

2

How do I fix CVE-2025-6921?

To fix CVE-2025-6921, upgrade the Hugging Face transformers library to version 4.53.0 or later.

3

What impact does CVE-2025-6921 have on the Hugging Face transformers library?

CVE-2025-6921 can lead to potential denial of service by exploiting the regular expression processing in the AdamWeightDecay optimizer.

4

Which versions of Hugging Face transformers are affected by CVE-2025-6921?

CVE-2025-6921 affects all versions of Hugging Face transformers prior to 4.53.0.

5

Is user input involved in triggering CVE-2025-6921?

Yes, CVE-2025-6921 involves user-controlled regular expressions that can exploit the vulnerability.

Contact

SecAlerts Pty Ltd.
132 Wickham Terrace
Fortitude Valley,
QLD 4006, Australia
info@secalerts.co
By using SecAlerts services, you agree to our services end-user license agreement. This website is safeguarded by reCAPTCHA and governed by the Google Privacy Policy and Terms of Service. All names, logos, and brands of products are owned by their respective owners, and any usage of these names, logos, and brands for identification purposes only does not imply endorsement. If you possess any content that requires removal, please get in touch with us.
© 2026 SecAlerts Pty Ltd.
ABN: 70 645 966 203, ACN: 645 966 203