Hugging Face Transformers library has Regular Expression Denial of Service
The normalize_numbers() method in the EnglishNormalizer class used a regular expression that could be made to consume excessive CPU when given a long sequence of digits. An attacker could send crafted input to cause a denial of service in text-to-speech and number normalization tasks.
huggingface/transformers
Originally disclosed on huntr
A Regular Expression Denial of Service (ReDoS) vulnerability was discovered in the Hugging Face Transformers library, specifically within the normalize_numbers() method of the EnglishNormalizer class. This vulnerability affects versions up to 4.52.4 and is fixed in version 4.53.0. The issue arises from the method's handling of numeric strings, which can be exploited using crafted input strings containing long sequences of digits, leading to excessive CPU consumption. This vulnerability impacts text-to-speech and number normalization tasks, potentially causing service disruption, resource exhaustion, and API vulnerabilities.
From the GitHub Advisory Database (GHSA-rcv9-qm8p-9p6j, CC BY 4.0).
Not written yet. The AI write-up for this report has not been written yet. The Original tab links to the source.
How it worked
Root cause
Likely the regular expression used in normalize_numbers() had catastrophic backtracking when matching long digit sequences.
Impact
An attacker could cause service disruption, resource exhaustion, and API vulnerabilities by sending crafted input, potentially affecting availability.
What the attacker needed
Ability to supply input to normalize_numbers()
The fix
The vulnerability was fixed in version 4.53.0.
Explained by bugbounty.wiki with AI from the original and checked against quotes from it; it can still be wrong. Read the original before relying on a detail.
Not written yet. The AI write-up for this report has not been written yet. The Original tab links to the source.
A regular expression is a pattern used to find or replace text. Some patterns can take a very long time to process certain inputs, which is called a regular expression denial of service (ReDoS). Here, a long string of digits made the number-normalizing function work very hard, slowing down or stopping the service for others.
What is DoS?
A request that exhausts resources or crashes a component. Many programs forbid testing it; reports usually show it from code, not by attacking.