Skip to main content
Vulnerability Database/CVE-2024-41128

CVE-2024-41128: Action Pack ReDoS DOS Vulnerability

CVE-2024-41128 is a ReDoS vulnerability in Action Pack that affects query parameter filtering routines. Malicious requests can cause excessive processing time leading to denial of service. This article covers technical details, affected versions, and mitigation strategies.

Published:

Disclaimer: This content was generated using AI. While we strive for accuracy, please verify critical information with official sources.

Sources: National Vulnerability Database, CISA KEV, Exploit-DB

CVE-2024-41128 Overview

CVE-2024-41128 is a Regular Expression Denial of Service (ReDoS) vulnerability in Action Pack, the Ruby on Rails framework that handles web requests. The flaw resides in the query parameter filtering routines of Action Dispatch. Carefully crafted query parameters can force the filtering logic into catastrophic backtracking, consuming CPU cycles and degrading application availability. The issue affects Rails versions from 3.1.0 up to the patched releases 6.1.7.9, 7.0.8.5, 7.1.4.1, and 7.2.1.1. Applications running Ruby 3.2 or newer are unaffected because Ruby 3.2 includes ReDoS mitigations in its regex engine.

Critical Impact

Unauthenticated remote attackers can send crafted query strings to exhaust CPU on affected Rails applications, resulting in denial of service against web endpoints that use parameter filtering or redirect filtering.

Affected Products

  • Ruby on Rails Action Pack >= 3.1.0, < 6.1.7.9
  • Ruby on Rails Action Pack >= 7.0.0, < 7.0.8.5 and >= 7.1.0, < 7.1.4.1
  • Ruby on Rails Action Pack >= 7.2.0, < 7.2.1.1

Discovery Timeline

  • 2024-10-16 - CVE-2024-41128 published to the National Vulnerability Database
  • 2026-06-17 - Last updated in NVD database

Technical Details for CVE-2024-41128

Vulnerability Analysis

The vulnerability is categorized as Algorithmic Complexity Attack and maps to [CWE-770: Allocation of Resources Without Limits or Throttling]. Action Dispatch filters sensitive query parameters before logging or including them in redirect responses. The filtering routine applied a regular expression against the full query string to split key-value pairs. The regex contained adjacent character classes that triggered exponential backtracking when fed specifically crafted input. An attacker can submit HTTP requests with query strings designed to maximize backtracking, pinning worker threads at 100% CPU. Because the attack vector is network-based and requires no authentication or user interaction, any public Rails endpoint that invokes parameter filtering is reachable.

Root Cause

The root cause is the regular expression PAIR_RE = %r{(#{KV_RE})=(#{KV_RE})} where KV_RE = "[^&;=]+". When this pattern is applied through query_string.gsub(PAIR_RE) against adversarially crafted input, the regex engine performs catastrophic backtracking in pre-3.2 Ruby runtimes.

Attack Vector

An unauthenticated remote attacker sends HTTP requests containing crafted query strings to any Rails endpoint that triggers logging, redirect filtering, or any code path invoking filtered_query_string. The expensive regex evaluation blocks the application worker for a sustained period, exhausting the worker pool and denying service to legitimate users.

ruby
# Vulnerable logic (pre-patch) in filter_parameters.rb
KV_RE   = "[^&;=]+"
PAIR_RE = %r{(#{KV_RE})=(#{KV_RE})}

def filtered_query_string
  query_string.gsub(PAIR_RE) do |_|
    parameter_filter.filter($1 => $2).first.join("=")
  end
end

# Patched logic replaces the regex with a linear split
def filtered_query_string
  parts = query_string.split(/([&;])/)
  filtered_parts = parts.map do |part|
    if part.include?("=")
      key, value = part.split("=", 2)
      parameter_filter.filter(key => value).first.join("=")
    else
      part
    end
  end
  filtered_parts.join("")
end

Source: Rails Commit 27121e80

Detection Methods for CVE-2024-41128

Indicators of Compromise

  • HTTP access logs showing abnormally long request durations for GET requests with large or repetitive query strings.
  • Rails application worker processes sustaining 100% CPU utilization while handling a single request.
  • Spikes in 5xx errors or request timeouts correlated with unusual query parameter payloads from a small set of source IPs.

Detection Strategies

  • Instrument Rack middleware to measure per-request wall-clock time and emit alerts when individual requests exceed a baseline threshold.
  • Inspect reverse proxy logs for query strings exceeding a reasonable length (for example, 2 KB) targeting authentication, redirect, or logging-heavy endpoints.
  • Hunt for repeated requests from the same source IP that match patterns of nested key-value structures intended to maximize regex backtracking.

Monitoring Recommendations

  • Track Ruby process CPU time and Puma or Unicorn worker queue depth, alerting when sustained saturation occurs without a matching request volume increase.
  • Forward web server and Rails production logs to a centralized data lake and correlate request duration anomalies with source IP and User-Agent.
  • Monitor availability of Rails endpoints with synthetic probes and alert on latency regressions following unusual inbound traffic patterns.

How to Mitigate CVE-2024-41128

Immediate Actions Required

  • Upgrade Action Pack to 6.1.7.9, 7.0.8.5, 7.1.4.1, or 7.2.1.1 depending on the branch currently deployed.
  • If an immediate upgrade is not possible, apply the upstream Rails patches directly to the vendored gem.
  • Deploy Web Application Firewall (WAF) rules to drop requests with abnormally long or malformed query strings until patching completes.

Patch Information

The Rails security team fixed the vulnerability by replacing the backtracking-prone regex with a linear string split. Review the fixes in Rails Commit 27121e80, Rails Commit b0fe99fa, Rails Commit b1241f46, and Rails Commit fb493beb. Additional details are available in GHSA-x76w-6vjr-8xgj and the Red Hat advisory for CVE-2024-41128.

Workarounds

  • Run the Rails application on Ruby 3.2 or newer, which includes regex engine mitigations that neutralize this ReDoS pattern.
  • Enforce request timeouts at the application server (Puma, Unicorn) and the fronting proxy to cap worker time spent on any single request.
  • Restrict maximum query string length at the load balancer or WAF to reduce the input surface available for crafted payloads.
bash
# Example: upgrade Rails via Bundler to a patched release
bundle update rails --conservative
# Verify installed Action Pack version
bundle info actionpack | grep -i version
# Alternative: pin a safe version in Gemfile
# gem "rails", "~> 7.1.4.1"

Disclaimer: This content was generated using AI. While we strive for accuracy, please verify critical information with official sources.

Sources: National Vulnerability Database, CISA KEV, Exploit-DB

Experience the Most Advanced Cybersecurity Platform

See how the world’s most intelligent, autonomous cybersecurity platform can protect your organization today and into the future.