Overview
CVE-2026-142591 describes a regular-expression denial-of-service (ReDoS) class issue in Rack, the modular Ruby web server interface that sits beneath most Ruby web frameworks. The flaw lives in Rack::QueryParser, where quantified patterns used for splitting query strings, processing application/x-www-form-urlencoded bodies, and matching bracketed parameter names can be forced into excessive backtracking by carefully chosen input.
The advisory assigns a CVSS score of 5.3, and there is currently no evidence of exploitation in the wild and no listing on the CISA Known Exploited Vulnerabilities catalog. The unauthenticated, network-reachable nature of the parser still makes timely patching worthwhile for services that accept untrusted input.
Technical Details
Three quantified regular expressions are involved in the amplification:
DEFAULT_SEPandCOMMON_SEP, used when splitting query strings and form-encoded bodies.
- The bracketed parameter-name matcher used inside
params_hash_has_key?.
- The bracketed parameter-name matcher used inside the Rack 2.2
normalize_paramscode path.
When an attacker submits a long run of whitespace characters following an ampersand, or a long run of bracket characters inside a parameter name, Ruby's regular-expression engine allocates approximately 48 bytes of backtracking state per input character. A single malicious request can therefore cause substantial transient memory allocation, and a burst of concurrent requests can push a Ruby process or container past its memory ceiling.
The advisory highlights why two existing configuration knobs are not enough on their own:
RACK_QUERY_PARSER_BYTESIZE_LIMITbounds the total request size, but does not eliminate the per-character amplification that occurs within the allowed size.
RACK_QUERY_PARSER_PARAMS_LIMITcaps the number of parameters, but the attack only requires very few parameters to trigger amplification.
Affected Systems
The vulnerability affects Rack releases prior to the following fixed versions:
- Rack 2.2.x: vulnerable before 2.2.26; fixed in 2.2.26.
- Rack 3.1.x: vulnerable before 3.1.24; fixed in 3.1.24.
- Rack 3.2.x: vulnerable before 3.2.9; fixed in 3.2.9.
Any application that handles untrusted HTTP input through Rack — including services built on Rails, Sinatra, Hanami, Roda, and most Ruby-based APIs — may be exposed if it ships a vulnerable Rack dependency.
Mitigation
The primary remediation is to upgrade Rack to a fixed release matching the deployed branch:
- Upgrade to Rack 2.2.26, 3.1.24, or 3.2.9 depending on the major.minor line in use.
Where an immediate upgrade is not possible, several compensating controls reduce exposure:
- Place the service behind a reverse proxy or Web Application Firewall that rejects abnormally long runs of whitespace following ampersands and unusually long bracket sequences inside parameter names.
- Lower
RACK_QUERY_PARSER_BYTESIZE_LIMITto shrink the amplification window, while recognising that this caps rather than eliminates the issue.
- Do not rely on
RACK_QUERY_PARSER_PARAMS_LIMITas a primary defence, because the attack needs only a small number of parameters.
- Enforce per-process, container, or pod memory limits so that a burst of malicious requests cannot exhaust host memory.
- After upgrading, confirm that the loaded Rack dependency is the fixed release and restart or redeploy every instance that serves requests.
Detection Notes
Operators hunting for exploitation attempts can look for query strings and form-encoded bodies containing long stretches of spaces between ampersands, or long bracket-laden parameter names, together with disproportionately high Ruby heap or allocator activity. Memory pressure spikes that coincide with small request payloads are a strong signal worth investigating.
منابع
- github.com/rack/rack/commit/59fae908d13587922b…61441d4de0cab6
- github.com/rack/rack/commit/bc0ad07de8603e545f…d28b9e7ec29804
- github.com/rack/rack/commit/d895d94b88a3233eb0…db9fc6a0b630ef
- github.com/rack/rack/releases/tag/v2.2.26
- github.com/rack/rack/releases/tag/v3.1.24
- github.com/rack/rack/releases/tag/v3.2.9
- github.com/rack/rack/security/advisories/GHSA-f7cc-57h7-qrcg