NIST deprecates RSA-2048 from 2030. Find every one of them before attackers do.
💎
💎 RubyGems
Not in CISA KEV
MEDIUM severity

CVE-2025-27220 — cgi

MEDIUMFix: ruby/cgi#52

CVE-2025-27220 is a medium-severity (CVSS 4) CWE-1333 vulnerability in cgi. A fix is available for cgi — see the affected versions and patch details below.

CGI has Regular Expression Denial of Service (ReDoS) potential in Util#escapeElement

Also known asGHSA-mhwm-jh88-3gjf
Published
Updated
Affected
3 pkgs
Patched
3 / 3
Exploits
None indexed
Exploitation data as of Oct 31, 2026 · OSV.dev, NVD, FIRST.org (EPSS)

Exploitation Status

No confirmed exploitation observed yet

  • CISA’s own triage has not observed active exploitation or public proof-of-concept code for this CVE as of its last assessment.

Exploitation and automatability from CISA’s SSVC triage for CVE-2025-27220.

EPSS Exploitation Probability

via FIRST.org ↗
0.8%probability of exploitation in next 30 days
Lower Risk0.00%
Lower risk than most CVEs55th percentile — riskier than 55% of all scored CVEsHighest risk
0.00%0.42%0.84%1.26%0.3%0.8%May 26Aug 26Oct 26

Probability of exploitation in the next 30 days, from FIRST.org EPSS.

How urgent is this, really

Where this sits among everything scored

Real-World Exposure

3 pkgs affected
💎cgi💎cgi💎cgi

Real-time download stats are indexed for npm and PyPI packages. This vulnerability affects RubyGems packages — download data is not available via public APIs for these ecosystems.

Description

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.

Affected Packages

3 total 3 fixed
EcosystemPackageVulnerable rangeFix
💎RubyGemscgiall versions0.3.5.1bundle update cgi --conservative
💎RubyGemscgi≥ 0.3.6&&< 0.3.70.3.7bundle update cgi --conservative
💎RubyGemscgi≥ 0.4.0&&< 0.4.20.4.2bundle update cgi --conservative

Affected Products

1 product · 3 configurations
Application
cgiruby-lang
≥ 0.4.0 && < 0.4.2
1 version
0.3.6

Detection & mitigation playbook

Open-source dependency
  1. Detect

    Scan your dependency tree (package-lock.json, pnpm-lock.yaml, requirements.txt, go.sum, etc.) for cgi, including transitive dependencies — a direct dependency you never call can still pull in a vulnerable version.

  2. Fix

    Update cgi to 0.3.5.1 or later, then make sure no transitive (indirect) dependency still pins the vulnerable range — O3 confirms CVE-2025-27220 is resolved across your whole dependency graph.

  3. Workarounds

    Cap what an attacker can consume: apply request size, rate and timeout limits in front of the affected component, and run it with memory and CPU limits so exhaustion degrades one worker rather than the whole service.

Fixing This On Your OS

If you run this on a Linux distribution, patch through your package manager against the distro's own security advisory below — it tracks the exact backported fix for your release, which can ship on a different timeline (and sometimes a different severity) than the upstream project.

Red HatModerate

This issue will cause an excessive resource consumption, potentially resulting in a degraded application performance. However, an attacker does have the ability to completely deny service to legitimate users. As such, Red hat has rated the CVSS Availability as LOW instead of HIGH.

Workaround published by Red Hat
Mitigation for this issue is either not available or the currently available options do not meet the Red Hat Product Security criteria comprising ease of use and deployment, applicability to widespread installation base or stability.
Source: Red Hat security advisory for CVE-2025-27220 (CC BY 4.0)
ProductFixed inAdvisory
Red Hat Enterprise Linux 8ruby:3.1-8100020250407112943.489197e6RHSA-2025:4063
Red Hat Enterprise Linux 9ruby-0:3.0.7-165.el9_5RHSA-2025:4487
Red Hat Enterprise Linux 9ruby:3.1-9050020250404144903.9RHSA-2025:4488

Frequently Asked Questions

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 svalk
O3 Security · Impact-Aware SCA

Is CVE-2025-27220 in your dependencies?

Find it across RubyGems, including transitive dependencies.

CVE-2025-27220: cgi DoS — Fixed in 0.3.5.1