Back

MEDIUM

Regular Expression Denial of Service (ReDoS) in huggingface/transformers

Published Jul 7, 2025

Description

A Regular Expression Denial of Service (ReDoS) vulnerability was discovered in the Hugging Face Transformers library, specifically in the `get_imports()` function within `dynamic_module_utils.py`. This vulnerability affects versions 4.49.0 and is fixed in version 4.51.0. The issue arises from a regular expression pattern `\s*try\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 products

Remediation

Red Hat mitigation

Mitigation for this issue is either not available or the currently available options do not meet the Red Hat Product Security criteria comprising ease of use and deployment, applicability to widespread installation base or stability.

Weaknesses (1)

References (9)

Change history (0)

No recorded changes yet.

Sources
CVE.org / MITRE
Status PUBLISHED
Assigner @huntr_ai
Published Jul 7, 2025
Updated Jul 7, 2025
Reserved Apr 4, 2025
CISA Vulnrichment
Updated Jul 7, 2025
NVD
Status Analyzed
Modified Jun 17, 2026
Red Hat
Severity Moderate
Public date Jul 7, 2025
ENISA EUVD
Assigner @huntr_ai
Published Jul 7, 2025
Updated Jul 7, 2025
Exploited since n/a
EUVD-2025-20214 GHSA-JJPH-296X-MRCR