CVE-2025-27220 CGI has Regular Expression Denial of Service (ReDoS) potential in Util#escapeElement
An attacker can cause a denial of service in Ruby applications using the CGI gem by exploiting a Regular Expression Denial of Service vulnerability in the escapeElement method.
- Exploited in the wild
- Not known
- Login needed
- Not needed
- Attackable
- Over the internet
- Victim action needed
- Not needed
- Fix
- Available
What is CVE-2025-27220?
CVE-2025-27220 is a medium-severity denial of service vulnerability in ruby-lang CGI, published on 3 Mar 2025. An attacker can exploit it over the internet without logging in, with no action from the victim.
Official description
In the CGI gem before 0.4.2 for Ruby, a Regular Expression Denial of Service (ReDoS) vulnerability exists in the Util#escapeElement method.
Weakness: CWE-1333
Which versions are affected by CVE-2025-27220?
6 open source packages ship an affected version, including cgi. It affects 1 product.
| Package | Affected | Fixed in |
|---|---|---|
cgi RubyGems | All versions | 0.3.5.1 |
cgi RubyGems | All versions | 0.3.5.1 |
cgi RubyGems | From 0.3.6 | 0.3.7 |
cgi RubyGems | From 0.3.6 | 0.3.7 |
cgi RubyGems | From 0.4.0 | 0.4.2 |
cgi RubyGems | From 0.4.0 | 0.4.2 |
Products include Ruby-Lang Cgi.
How do I fix CVE-2025-27220?
Upgrade cgi to a fixed version for your release line: 0.3.5.1, 0.3.7 or 0.4.2.
Upgrade, then put limits on request size, rate and nesting depth so one client cannot exhaust the service. More about Denial of service.
Is CVE-2025-27220 being exploited?
There is no known exploitation of CVE-2025-27220 in the wild and no public exploit code.
Other vulnerabilities in ruby-lang CGI
Sources
Also known as AZL-57791, AZL-57938, CLEANSTART-2026-HJ24461, CLEANSTART-2026-QG16537, DEBIAN-CVE-2025-27220, ECHO-edf3-cb70-6d3e and 15 more.