⚠️

سلب مسئولیت و اخلاق حرفه‌ای

این مطالب صرفاً برای اهداف آموزشی، پژوهشی و افزایش آگاهی امنیتی ارائه شده‌اند. هرگونه استفاده غیرمجاز، غیرقانونی یا سوءاستفاده از اطلاعات، ابزارها و روش‌های مطرح‌شده، کاملاً بر عهده مخاطب است. نویسنده و منتشرکننده هیچ مسئولیتی در قبال خسارات، آسیب‌ها یا پیامدهای ناشی از استفاده نادرست از این مطالب نخواهند داشت.

CVE-2026-142591: Rack QueryParser Regex Amplification Opens Door to Memory Exhaustion | Alireza Bolbolabadi - Red Team Security
LOADING

CVE-2026-142591: Rack QueryParser Regex Amplification Opens Door to Memory Exhaustion

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_SEP and COMMON_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_params code 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_LIMIT bounds the total request size, but does not eliminate the per-character amplification that occurs within the allowed size.

  • RACK_QUERY_PARSER_PARAMS_LIMIT caps 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_LIMIT to shrink the amplification window, while recognising that this caps rather than eliminates the issue.

  • Do not rely on RACK_QUERY_PARSER_PARAMS_LIMIT as 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.

منابع

·
← اخبار