Transformers vulnerable to ReDoS attack through its SETTING_RE variable
The SETTING_RE regular expression in transformers/commands/chat.py had inefficient complexity, causing exponential backtracking on almost-matching input. An attacker could supply crafted strings to degrade performance and potentially cause a denial of service.
huggingface/transformers
Originally disclosed on huntr
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 SETTING_RE 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.
From the GitHub Advisory Database (GHSA-489j-g2vx-39wf, 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
The regular expression SETTING_RE uses repetition groups and non-optimised quantifiers, causing exponential backtracking on almost-matching input.
Impact
This could degrade application performance and potentially result in a denial of service when handling specially crafted input strings.
What the attacker needed
Ability to supply input to the chat command
The fix
The issue was fixed in version 4.51.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 match text. Some patterns can take a very long time to fail when given input that almost matches, which is called exponential backtracking. Here, a crafted string could make the chat command slow down or hang, which is a denial of service.
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.