[CVE-2025-27220] ReDoS in CGI::Util#escapeElement
The regular expression in CGI::Util#escapeElement is vulnerable to ReDoS, allowing crafted input to cause high CPU consumption.
- Disclosed after 56 days
Summary by the program
There is a possibility for Regular expression Denial of Service(ReDoS) by in the cgi gem. This vulnerability has been assigned the CVE identifier CVE-2025-27220. We recommend upgrading the cgi gem.
https://www.ruby-lang.org/en/news/2025/02/26/security-advisories/
The report
I've made a report at https://hackerone.com/reports/2890322
There is a possibility for Regular expression Denial of Service(ReDoS) by in the cgi gem
Impact
The regular expression used in CGI::Util#escapeElement is vulnerable to ReDoS. The crafted input could lead to a high CPU consumption.
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 in CGI::Util#escapeElement has catastrophic backtracking, causing excessive CPU use on crafted input.
Impact
A crafted input could cause high CPU consumption, potentially leading to denial of service.
What the attacker needed
Ability to supply input to escapeElement
The fix
Upgrade the cgi gem to a version that fixes the vulnerability.
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 be made to run very slowly by specially crafted input, which ties up the computer's processor. This is called a regular expression denial of service (ReDoS).
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.