CVE-2025-27220: CGI has Regular Expression Denial of Service (ReDoS) potential in Util#escapeElement
Affects cgiSource GCVE Database
Not known to be exploited · CVSS 4.0 Medium : upgrade to 0.3.5.1 when convenient.
Data as of 30 Oct 2026, 16:05 UTC
Thin evidence
One scorer or none| CNA (mitre) | CVSS 3.1 | 4.0 |
|---|
- Patch
- Available – fixed in 0.3.5.1, 0.3.7, 0.4.2
CVSS:3.1/AV:N/AC:H/PR:N/UI:N/S:C/C:N/I:N/A:LExploitation evidence
Disclosed: evidence found.
CVE published 3 Mar 2025
Detectable: no evidence on record.
No public nuclei template indexed
Weaponized: no evidence on record.
No public exploit code indexed in Metasploit or Exploit-DB
Exploited in the wildExploited: no evidence on record.
Not in CISA KEV and no source reports exploitation
Observed by OffSeq MirageSeen by Mirage: no evidence on record.
No attack traffic recorded by OffSeq Mirage sensors
A missing step is not evidence of safety. Sources: cve.org (opens in a new tab), the Metasploit, Exploit-DB and nuclei-templates index as of 30 Oct 2026.
What to do
Upgrade cgi to 0.3.5.1; cgi to 0.3.7; cgi to 0.4.2.
Affected software
| Product | Affected | Fixed in |
|---|---|---|
| RubyGemscgi | Affected
| Fixed in
|
| RubyGemscgi | Affected
| Fixed in
|
| RubyGemscgi | Affected
| Fixed in
|
Check your own hosts for these packages with threat-finder (opens in a new tab), our free open-source scanner.
AI-suggested
Upgrade the cgi gem to version 0.3.5.1, 0.3.7, 0.4.2 or later to remediate this vulnerability. These versions contain the official fixes. No other mitigation is required if the gem is updated.
Description
A Regular Expression Denial of Service (ReDoS) vulnerability exists in the cgi gem's CGI::Util#escapeElement method affecting certain versions. Crafted input can cause excessive CPU consumption. This impacts cgi gem versions <=0.3.5, 0.3.6, 0.4.0, and 0.4.1. Fixed versions are 0.3.5.1, 0.3.7, and 0.4.2 or later. The vulnerability affects Ruby 3.1 and 3.2 environments using these gem versions.
References
- nvd.nist.gov/vuln/detail/CVE-2025-27220 (opens in a new tab)
- github.com/ruby/cgi/pull/52 (opens in a new tab)
- github.com/ruby/cgi/pull/53 (opens in a new tab)
- github.com/ruby/cgi/pull/54 (opens in a new tab)
- hackerone.com/reports/2890322 (opens in a new tab)
- github.com/ruby/cgi (opens in a new tab)
- github.com/rubysec/ruby-advisory-db/blob/master/gems/cgi/CVE-2025-27220.yml (opens in a new tab)
- lists.debian.org/debian-lts-announce/2025/03/msg00008.html (opens in a new tab)
- cve.org/CVERecord?id=CVE-2025-27220 (opens in a new tab)
- ruby-lang.org/en/news/2025/02/26/security-advisories (opens in a new tab)