Gradio Vulnerable to Denial of Service (DoS) via Crafted HTTP Request
A regular expression used to parse user input in the gr.Datetime component can take polynomial time to match certain crafted strings. An attacker could send a crafted HTTP request to consume 100% CPU and cause a denial of service.
gradio-app/gradio
Originally disclosed on huntr
A Regular Expression Denial of Service (ReDoS) vulnerability exists in the gradio-app/gradio repository, affecting the gr.Datetime component. The affected version is git commit 98cbcae. The vulnerability arises from the use of a regular expression ^(?:\s*now\s*(?:-\s*(\d+)\s*([dmhs]))?)?\s*$ to process user input. In Python's default regex engine, this regular expression can take polynomial time to match certain crafted inputs. An attacker can exploit this by sending a crafted HTTP request, causing the gradio process to consume 100% CPU and potentially leading to a Denial of Service (DoS) condition on the server.
From the GitHub Advisory Database (GHSA-rvgh-pr46-x7gg, 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 to parse the datetime input has nested optional groups that cause excessive backtracking on certain inputs.
Impact
An attacker could cause the gradio process to consume 100% CPU, potentially leading to a denial of service on the server.
What the attacker needed
Ability to send HTTP requests to the server
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 check text. Some patterns can become very slow when given specially crafted input, making the program use all its processing power. Here, an attacker could send a request that makes the server busy and unable to respond to 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.