{"id":"CVE-2025-27220","aliases":["CVE-2025-27220","GHSA-mhwm-jh88-3gjf"],"related":[],"kind":"vulnerability","state":"published","title":"CGI has Regular Expression Denial of Service (ReDoS) potential in Util#escapeElement","summary":"In the CGI gem before 0.4.2 for Ruby, a Regular Expression Denial of Service (ReDoS) vulnerability exists in the Util#escapeElement method.","summarySource":"cvelist","descriptions":[{"lang":"en","text":"In the CGI gem before 0.4.2 for Ruby, a Regular Expression Denial of Service (ReDoS) vulnerability exists in the Util#escapeElement method.","source":"cvelist"},{"lang":"en","text":"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.\n\n## Details\n\nThe regular expression used in `CGI::Util#escapeElement` is vulnerable to ReDoS. The crafted input could lead to a high CPU consumption.\n\nThis 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.\n\n## Affected versions\n\ncgi gem versions <= 0.3.5, 0.3.6, 0.4.0 and 0.4.1.\n\n## Credits\n\nThanks to svalkanov for discovering this issue.\nAlso thanks to nobu for fixing this vulnerability.","format":"markdown","source":"ghsa"},{"lang":"es","text":"En la gema CGI anterior a 0.4.2 para Ruby, existe una vulnerabilidad de denegación de servicio de expresión regular (ReDoS) en el método Util#escapeElement.","source":"nvd"}],"published":"2025-03-03T00:00:00.000Z","modified":"2026-09-10T03:50:56.878Z","severity":{"scorer":"mitre","scheme":"CVSS:3.1","vector":"CVSS:3.1/AV:N/AC:H/PR:N/UI:N/S:C/C:N/I:N/A:L","score":4,"rating":"MEDIUM"},"severities":[{"scorer":"mitre","scheme":"CVSS:3.1","vector":"CVSS:3.1/AV:N/AC:H/PR:N/UI:N/S:C/C:N/I:N/A:L","score":4,"rating":"MEDIUM"},{"scorer":"GitHub","scheme":"CVSS:3.1","vector":"CVSS:3.1/AV:N/AC:H/PR:N/UI:N/S:C/C:N/I:N/A:L","score":4,"rating":"MEDIUM"},{"scorer":"GitHub","scheme":"CVSS:4.0","vector":"CVSS:4.0/AV:N/AC:H/AT:P/PR:N/UI:N/VC:N/VI:N/VA:L/SC:N/SI:N/SA:N","rating":"MEDIUM"},{"scorer":"NVD","scheme":"CVSS:3.1","vector":"CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:N/I:N/A:H","score":7.5,"rating":"HIGH"}],"cwes":["CWE-1333"],"affected":[{"ranges":[{"type":"custom","introduced":"0","fixed":"0.3.5.1","status":"affected"},{"type":"custom","introduced":"0.3.6","fixed":"0.3.7","status":"affected"},{"type":"custom","introduced":"0.4.0","fixed":"0.4.2","status":"affected"}],"vendor":"ruby-lang","product":"CGI","source":"cvelist"},{"ranges":[{"type":"ecosystem","introduced":"0","status":"affected","fixed":"0.3.5.1"}],"ecosystem":"RubyGems","package":"cgi","purl":"pkg:gem/cgi","source":"ghsa"},{"ranges":[{"type":"ecosystem","introduced":"0.3.6","status":"affected","fixed":"0.3.7"}],"ecosystem":"RubyGems","package":"cgi","purl":"pkg:gem/cgi","source":"ghsa"},{"ranges":[{"type":"ecosystem","introduced":"0.4.0","status":"affected","fixed":"0.4.2"}],"ecosystem":"RubyGems","package":"cgi","purl":"pkg:gem/cgi","source":"ghsa"},{"ranges":[{"status":"affected","fixed":"0.3.5.1"},{"status":"affected","introduced":"0.4.0","fixed":"0.4.2"},{"status":"affected","version":"0.3.6"}],"vendor":"ruby-lang","product":"cgi","cpe":"cpe:2.3:a:ruby-lang:cgi:*:*:*:*:*:ruby:*:*","source":"nvd"}],"references":[{"url":"https://hackerone.com/reports/2890322","tags":["permissions-required","web"],"sources":["cvelist","ghsa","nvd"]},{"url":"https://github.com/rubysec/ruby-advisory-db/blob/master/gems/cgi/CVE-2025-27220.yml","tags":["third-party-advisory","web"],"sources":["cvelist","ghsa","nvd"]},{"url":"https://lists.debian.org/debian-lts-announce/2025/03/msg00008.html","tags":["web"],"sources":["cvelist","ghsa","nvd"]},{"url":"https://nvd.nist.gov/vuln/detail/CVE-2025-27220","tags":["advisory"],"sources":["ghsa"]},{"url":"https://github.com/ruby/cgi/pull/52","tags":["web"],"sources":["ghsa"]},{"url":"https://github.com/ruby/cgi/pull/53","tags":["web"],"sources":["ghsa"]},{"url":"https://github.com/ruby/cgi/pull/54","tags":["web"],"sources":["ghsa"]},{"url":"https://github.com/ruby/cgi","tags":["package"],"sources":["ghsa"]},{"url":"https://www.cve.org/CVERecord?id=CVE-2025-27220","tags":["web"],"sources":["ghsa"]},{"url":"https://www.ruby-lang.org/en/news/2025/02/26/security-advisories","tags":["web"],"sources":["ghsa"]}],"credits":[],"assigner":"mitre","ssvc":{"scorer":"CISA-ADP","exploitation":"none","automatable":"no","technicalImpact":"partial","date":"2025-03-04T16:39:36.614Z"},"sources":[{"source":"cvelist","name":"CVE List","id":"CVE-2025-27220","url":"https://www.cve.org/CVERecord?id=CVE-2025-27220","licence":"CVE Terms of Use","modified":"2025-11-03T21:13:25.250Z"},{"source":"ghsa","name":"GitHub Advisory Database","id":"GHSA-mhwm-jh88-3gjf","url":"https://github.com/advisories/GHSA-mhwm-jh88-3gjf","licence":"CC-BY-4.0","modified":"2026-09-10T03:50:56.878Z"},{"source":"nvd","name":"NVD","id":"CVE-2025-27220","url":"https://nvd.nist.gov/vuln/detail/CVE-2025-27220","licence":"Public domain","modified":"2026-06-17T09:03:14.260Z"}],"updatedAt":"2026-11-25T22:58:54.934Z","epss":{"score":0.0076,"percentile":0.565,"date":"2026-12-01T12:00:22.000Z"}}