CVE-2025-27220: High severity ruby vulnerability
In the CGI gem before 0.4.2 for Ruby, a Regular Expression Denial of Service (ReDoS) vulnerability exists in the Util#escapeElement method.
Other sources
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.
Details
The regular expression used in CGI::Util#escapeElement is vulnerable to ReDoS. The crafted input could lead to a high CPU consumption.
This vulnerability only affects Ruby 3.1 and 3.2. If you are using these versions, please update CGI gem to version 0.3.5.1, 0.3.7, 0.4.2 or later.
Affected versions
cgi gem versions <= 0.3.5, 0.3.6, 0.4.0 and 0.4.1.
Credits
Thanks to svalkanov for discovering this issue. Also thanks to nobu for fixing this vulnerability.
— GitHub
This CVE was automatically created from a reference found in an email or other text. If you are reading this, then this CVE entry is probably erroneous, since this text should be replaced by the official CVE description automatically.
— Launchpad
Affected Software
Event History
Frequently Asked Questions
What is the risk associated with CVE-2025-27220?
CVE-2025-27220 is associated with a Regular expression Denial of Service (ReDoS) vulnerability in the cgi gem.
How do I fix CVE-2025-27220?
To resolve CVE-2025-27220, upgrade the cgi gem to version 0.4.2 or later.
Which versions of the cgi gem are affected by CVE-2025-27220?
CVE-2025-27220 affects cgi gem versions below 0.4.2 and specifically versions 0.4.0 to 0.4.1, and 0.3.6.
Why is CVE-2025-27220 considered a Denial of Service vulnerability?
CVE-2025-27220 is classified as a Denial of Service vulnerability because an attacker can exploit the regex patterns to cause excessive resource consumption.
Where can I find more information about CVE-2025-27220?
More details about CVE-2025-27220 can typically be found in security advisories from the project maintainers or trusted vulnerability databases.