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

Published Jul 7, 2025
·
Updated

A Regular Expression Denial of Service (ReDoS) vulnerability was discovered in the Hugging Face Transformers library, specifically in the getimports() function within dynamicmoduleutils.py. This vulnerability affects versions 4.49.0 and is fixed in version 4.51.0. The issue arises from a regular expression pattern \stry\s:.?except.?: used to filter out try/except blocks from Python code, which can be exploited to cause excessive CPU consumption through crafted input strings due to catastrophic backtracking. This vulnerability can lead to remote code loading disruption, resource exhaustion in model serving, supply chain attack vectors, and development pipeline disruption.

Affected Software

4 affected componentsFixes available
Hugging Face Transformers
pip/transformers<4.51.0
4.51.0
huggingface transformers>=4.49.0<4.51.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.51.0
  2. Upgrade

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

    Fixed in 4.51.0

Event History

Jul 7, 2025
CVE Published
via MITRE·09:55 AM
Data Sourced
via MITRE·09:55 AM
DescriptionSeverityWeakness
Data Sourced
via NVD·10:15 AM
DescriptionSeverityWeakness
Data Sourced
via NVD·10:15 AM
RemedyAffected Software
Advisory Published
via GitHub·12:30 PM
Data Sourced
via GitHub·12:30 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-3264?

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

2

How do I fix CVE-2025-3264?

To fix CVE-2025-3264, upgrade the Hugging Face Transformers library to version 4.51.0 or later.

3

Which versions of the Hugging Face Transformers library are affected by CVE-2025-3264?

CVE-2025-3264 affects Hugging Face Transformers version 4.49.0.

4

What component of Hugging Face Transformers is impacted by CVE-2025-3264?

CVE-2025-3264 impacts the `get_imports()` function within `dynamic_module_utils.py` in the Hugging Face Transformers library.

5

What type of attack does CVE-2025-3264 enable?

CVE-2025-3264 enables a Regular Expression Denial of Service (ReDoS) attack.

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