CVE-2025-3262: 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 huggingface/transformers repository, specifically in version 4.49.0. The vulnerability is due to inefficient regular expression complexity in the SETTINGRE variable within the transformers/commands/chat.py file. The regex contains repetition groups and non-optimized quantifiers, leading to exponential backtracking when processing 'almost matching' payloads. This can degrade application performance and potentially result in a denial-of-service (DoS) when handling specially crafted input strings. The issue is fixed in version 4.51.0.

Affected Software

4 affected componentsFixes available
Hugging Face Transformers<4.51.0
pip/transformers>=4.49.0<4.51.0
4.51.0
huggingface transformers<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
  3. Configuration

    Update transformers so that the `SETTING_RE` variable in `transformers/commands/chat.py` uses the regex implementation from version 4.51.0 to prevent exponential backtracking on almost-matching payloads.

    transformers/commands/chat.py SETTING_RE = Use the optimized regex as in transformers version 4.51.0 (fixes inefficient regular expression complexity causing ReDoS)

Event History

Jul 7, 2025
CVE Published
via MITRE·09:54 AM
Data Sourced
via MITRE·09:54 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-3262?

The severity of CVE-2025-3262 is classified as Moderate due to its potential to cause a denial of service.

2

How do I fix CVE-2025-3262?

To fix CVE-2025-3262, upgrade the Hugging Face Transformers library to a version higher than 4.51.0.

3

What is the nature of the vulnerability in CVE-2025-3262?

CVE-2025-3262 is a Regular Expression Denial of Service (ReDoS) vulnerability caused by inefficient regular expression complexity.

4

Which versions of the software are affected by CVE-2025-3262?

CVE-2025-3262 affects Hugging Face Transformers version 4.49.0 and prior to 4.51.0.

5

Where can I find more information about CVE-2025-3262?

More information about CVE-2025-3262 can be found in the commit history of the Hugging Face Transformers repository.

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