GHSA-mhwm-jh88-3gjf 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
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 GHSA-mhwm-jh88-3gjf.
EPSS Exploitation Probability
EPSS (Exploit Prediction Scoring System) is a daily probability model maintained by FIRST.org. It estimates the likelihood a CVE will be exploited in production environments within the next 30 days, derived from real-world threat intelligence signals.
How urgent is this, really
GHSA-mhwm-jh88-3gjf plotted by exploitation likelihood (EPSS) against impact (CVSS). The shaded corner — EPSS 50%+ and CVSS 7.0+ — is where this CVE doesn't sit, though severity or exploitability alone can still warrant action.
Where this sits among everything scored
Of 377,166 CVEs with a current EPSS score, this one falls in the < 10% band (highlighted). Real counts from FIRST.org, not a sample — log-scaled since the landscape is heavily right-skewed.
Real-World Exposure
cgi💎cgi💎cgiReal-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
| Ecosystem | Package | Vulnerable range | Fix |
|---|---|---|---|
| 💎RubyGems | cgi | all versions | 0.3.5.1bundle update cgi --conservative |
| 💎RubyGems | cgi | ≥ 0.3.6&&< 0.3.7 | 0.3.7bundle update cgi --conservative |
| 💎RubyGems | cgi | ≥ 0.4.0&&< 0.4.2 | 0.4.2bundle update cgi --conservative |
Detection & mitigation playbook
Open-source dependencyDetect
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.
Fix
Update cgi to 0.3.5.1 or later, then make sure no transitive (indirect) dependency still pins the vulnerable range — O3 confirms GHSA-mhwm-jh88-3gjf is resolved across your whole dependency graph.
Workarounds
If you can't upgrade right away: gate or disable the affected feature, validate untrusted input at the boundary, and avoid passing attacker-controlled data into the vulnerable path. O3's runtime protection blocks exploitation in production as an interim safeguard until the upgrade lands.
How O3 protects you
O3 Security's impact-aware SCA analyses which vulnerable code paths your application actually calls, so a match like GHSA-mhwm-jh88-3gjf can be triaged on real exposure rather than presence alone.
Tailored to GHSA-mhwm-jh88-3gjf. Runtime protection reduces exposure until a permanent patch is applied and verified — it complements patching, it doesn't replace it.
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.
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.
| Product | Fixed in | Advisory |
|---|---|---|
| Red Hat Enterprise Linux 8 | ruby:3.1-8100020250407112943.489197e6 | RHSA-2025:4063 |
| Red Hat Enterprise Linux 9 | ruby-0:3.0.7-165.el9_5 | RHSA-2025:4487 |
| Red Hat Enterprise Linux 9 | ruby:3.1-9050020250404144903.9 | RHSA-2025:4488 |
Frequently Asked Questions
Is GHSA-mhwm-jh88-3gjf in your dependencies?
O3 Security finds GHSA-mhwm-jh88-3gjf across RubyGems dependencies, including transitive ones, and its impact-aware SCA ranks findings by whether your code actually calls the vulnerable path.