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

Published Aug 6, 2025
·
Updated

A Regular Expression Denial of Service (ReDoS) vulnerability exists in the Hugging Face Transformers library, specifically in the converttfweightnametoptweightname() function. This function, responsible for converting TensorFlow weight names to PyTorch format, uses a regex pattern /[^/]([^/])/ that can be exploited to cause excessive CPU consumption through crafted input strings due to catastrophic backtracking. The vulnerability affects versions up to 4.51.3 and is fixed in version 4.53.0. This issue can lead to service disruption, resource exhaustion, and potential API service vulnerabilities, impacting model conversion processes between TensorFlow and PyTorch formats.

Affected Software

4 affected componentsFixes available
Hugging Face Transformers<=4.51.3
pip/transformers<4.53.0
4.53.0
huggingface transformers<4.53.0
IBM watsonx.data intelligence<=5.2.0, 5.2.1, 5.2.2, 5.3.0

Remediation

Recommended actions to resolve this vulnerability, in priority order.

  1. Upgrade

    Upgrade pip/transformers to a version that resolves this vulnerability.

    Fixed in 4.53.0
  2. Upgrade

    Upgrade huggingface/transformers to a version that resolves this vulnerability.

    Fixed in 4.53.0

Event History

Aug 6, 2025
CVE Published
via MITRE·11:53 AM
Data Sourced
via MITRE·11:53 AM
DescriptionSeverityWeakness
Data Sourced
via NVD·12:15 PM
DescriptionSeverityWeakness
Data Sourced
via NVD·12:15 PM
RemedyAffected Software
Advisory Published
via GitHub·12:31 PM
Data Sourced
via GitHub·12:31 PM
DescriptionSeverityWeaknessAffected Software
Jun 24, 2026
Data Sourced
via IBM·12:00 AM
DescriptionAffected Software

Parent advisories

This vulnerability appears in the following advisories.

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-5197?

CVE-2025-5197 is classified as a Regular Expression Denial of Service (ReDoS) vulnerability.

2

How do I fix CVE-2025-5197?

To fix CVE-2025-5197, you should update the Hugging Face Transformers library to version 4.51.4 or later.

3

What software is affected by CVE-2025-5197?

CVE-2025-5197 affects the Hugging Face Transformers library versions up to and including 4.51.3.

4

What function in the Hugging Face Transformers library is vulnerable in CVE-2025-5197?

The vulnerable function in CVE-2025-5197 is `convert_tf_weight_name_to_pt_weight_name()`.

5

What type of attack can CVE-2025-5197 facilitate?

CVE-2025-5197 can facilitate a Denial of Service (DoS) attack through Regular Expression parsing.

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