Regular Expression Denial of Service (ReDoS) in huggingface/transformers
huggingface/transformers
huggingface/transformers
| Product | Affected | Fixed in |
|---|---|---|
| transformers PyPI |
|
|
A Regular Expression Denial of Service (ReDoS) vulnerability was discovered in the Hugging Face Transformers library, specifically affecting the MarianTokenizer's `remove_language_code()` method. This vulnerability is present in version 4.52.4 and has been fixed in version 4.53.0. The issue arises from inefficient regex processing, which can be exploited by crafted input strings containing malformed language code patterns, leading to excessive CPU consumption and potential denial of service.
From the CVE record · @huntr_ai
The MarianTokenizer remove_language_code() method in Hugging Face Transformers has a regular expression denial-of-service vulnerability. Processing a crafted string with a malformed language code pattern can consume excessive CPU and potentially cause a denial of service. The input does not specify network access, authentication requirements, or user interaction.
Engineers running the PyPI transformers package before version 4.53.0 should check their installations.