CVE-2024-25126: Rack Denial of Service Vulnerability

MODERATE
Advisory Identifier: GHSA-22f2-v57c-j9cx
CVSS 5.3
CWE-1333
Published
Advisory Summary

CVE-2024-25126 is a MODERATE (CVSS 5.3) denial of service vulnerability (CWE-1333: Inefficient Regular Expression Complexity) affecting Rack libraries in the RubyGems ecosystem. The issue involves rack vulnerable to redos in content type parsing (2nd degree polynomial). Remediation is available by upgrading affected packages to version 3.0.9.1, 2.2.8.1.

CVE-2024-25126 at a Glance

CVE Identifier CVE-2024-25126
GHSA Identifier GHSA-22f2-v57c-j9cx
Severity MODERATE
CVSS v3.1 Base Score 5.3
CWE Classification CWE-1333: Inefficient Regular Expression Complexity
Affected Product Rack
Package Ecosystem RubyGems
Published Date
Last Updated

Security Impact

CVSS: 5.3

The security impact metrics below are parsed directly from the CVSS v3.1 vector string (CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:N/I:N/A:L).

Attack Vector Network (AV:N)
Attack Complexity Low (AC:L)
Privileges Required None (PR:N)
User Interaction None (UI:N)
Scope Unchanged (S:U)
Confidentiality None (C:N)
Integrity None (I:N)
Availability Low (A:L)

How to Fix CVE-2024-25126

To remediate this vulnerability, upgrade all affected Rack dependencies to a patched release. Both direct and transitive dependencies should be checked, as frameworks or security libraries may pull in vulnerable versions transitively.

rack fixed: 3.0.9.1
Upgrade rack to 3.0.9.1
rack fixed: 2.2.8.1
Upgrade rack to 2.2.8.1
Verify Direct and Transitive Dependencies

Run the following command in your project directory to verify that all resolved dependencies use the patched release:

inspect dependencies for rack

How to Check if You Are Affected

To determine whether your application is affected by CVE-2024-25126, inspect your project dependencies for Rack:

inspect dependencies for rack

Analyze the terminal output to locate any version of Rack in your dependency tree. If any resolved version matches the vulnerable ranges listed in the table below (for example, versions earlier than 3.0.9.1), your application is affected.

Note: Verify declared build manifests and deployed runtime container environments.

Technical Details

Vulnerability Mechanism & Technical Analysis

This vulnerability is classified under CWE-1333: Inefficient Regular Expression Complexity, where the product uses a regular expression with a worst-case computational complexity that is inefficient and possibly exponential. In Rack, software state validation or input boundaries are circumvented during processing. Review the official source advisory statement below for specific affected components, classes, and reproduction details.

Source Advisory Statement

### Summary ```ruby module Rack class MediaType SPLIT_PATTERN = %r{\s*[;,]\s*} ``` The above regexp is subject to ReDos. 50K blank characters as a prefix to the header will take over 10s to split. ### PoC A simple HTTP request with lots of blank characters in the content-type header: ```ruby request["Content-Type"] = (" " * 50_000) + "a," ``` ### Impact It's a very easy to craft ReDoS. Like all ReDoS the impact is debatable.

CVE-2024-25126 Affected Rack Versions

2 component(s)
Fixed Versions:
3.0.9.12.2.8.1
Product / Package Ecosystem Affected Versions Fixed Version
rack
RubyGems
≥ 3.0.0
< 3.0.9.1
3.0.9.1
rack
RubyGems
≥ 0.4
< 2.2.8.1
2.2.8.1

References

Frequently Asked Questions

What is CVE-2024-25126?
CVE-2024-25126 is a security vulnerability in Rack involving Rack vulnerable to ReDoS in content type parsing (2nd degree polynomial) under CWE-1333: Inefficient Regular Expression Complexity.
Which Rack versions are affected?
Affected versions include releases prior to 3.0.9.1, 2.2.8.1 across affected packages: rack.
What version fixes CVE-2024-25126?
Upgrading to 3.0.9.1, 2.2.8.1 (or the latest patched release for your respective branch) resolves the vulnerability.
Is rack affected?
Yes, rack is affected in releases prior to 3.0.9.1, 2.2.8.1. Upgrade your dependency to 3.0.9.1, 2.2.8.1 or later.
What is the CVSS score of CVE-2024-25126?
CVE-2024-25126 has a CVSS v3.1 base score of 5.3 (MODERATE) with vector string CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:N/I:N/A:L.
What CWE is associated with CVE-2024-25126?
CVE-2024-25126 is classified under CWE-1333: Inefficient Regular Expression Complexity (The product uses a regular expression with a worst-case computational complexity that is inefficient and possibly exponential.).
How can I check RubyGems dependencies for CVE-2024-25126?
Run the dependency tree command: 'inspect dependencies for rack'. This command lists direct and transitive dependencies in your build configuration so you can verify if a vulnerable version is resolved.
Machine-readable OSV JSON OSV v1.5 Schema
Normalized schema output
{
  "schema_version" : "1.4.0",
  "id" : "GHSA-22f2-v57c-j9cx",
  "modified" : "2024-06-10T18:30:52Z",
  "published" : "2024-02-28T22:57:26Z",
  "aliases" : [ "CVE-2024-25126" ],
  "summary" : "Rack vulnerable to ReDoS in content type parsing (2nd degree polynomial)",
  "details" : "### Summary\n\n```ruby\nmodule Rack\n  class MediaType\n    SPLIT_PATTERN = %r{\\s*[;,]\\s*}\n```\nThe above regexp is subject to ReDos. 50K blank characters as a prefix to the header will take over 10s to split.\n\n### PoC\n\nA simple HTTP request with lots of blank characters in the content-type header:\n\n```ruby\nrequest[\"Content-Type\"] = (\" \" * 50_000) + \"a,\"\n```\n\n### Impact\n\nIt's a very easy to craft ReDoS. Like all ReDoS the impact is debatable.",
  "severity" : [ {
    "type" : "CVSS_V3",
    "score" : "CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:N/I:N/A:L"
  } ],
  "affected" : [ {
    "package" : {
      "ecosystem" : "RubyGems",
      "name" : "rack"
    },
    "ranges" : [ {
      "type" : "ECOSYSTEM",
      "events" : [ {
        "introduced" : "3.0.0"
      }, {
        "fixed" : "3.0.9.1"
      } ]
    } ]
  }, {
    "package" : {
      "ecosystem" : "RubyGems",
      "name" : "rack"
    },
    "ranges" : [ {
      "type" : "ECOSYSTEM",
      "events" : [ {
        "introduced" : "0.4"
      }, {
        "fixed" : "2.2.8.1"
      } ]
    } ]
  } ],
  "references" : [ {
    "type" : "WEB",
    "url" : "https://github.com/rack/rack/security/advisories/GHSA-22f2-v57c-j9cx"
  }, {
    "type" : "ADVISORY",
    "url" : "https://nvd.nist.gov/vuln/detail/CVE-2024-25126"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/rack/rack/commit/6efb2ceea003c4b195815a614e00438cbd543462"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/rack/rack/commit/d9c163a443b8cadf4711d84bd2c58cb9ef89cf49"
  }, {
    "type" : "WEB",
    "url" : "https://discuss.rubyonrails.org/t/denial-of-service-vulnerability-in-rack-content-type-parsing/84941"
  }, {
    "type" : "PACKAGE",
    "url" : "https://github.com/rack/rack"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/rubysec/ruby-advisory-db/blob/master/gems/rack/CVE-2024-25126.yml"
  }, {
    "type" : "WEB",
    "url" : "https://lists.debian.org/debian-lts-announce/2024/04/msg00022.html"
  }, {
    "type" : "WEB",
    "url" : "https://security.netapp.com/advisory/ntap-20240510-0005"
  } ],
  "database_specific" : {
    "cwe_ids" : [ "CWE-1333" ],
    "severity" : "MODERATE",
    "github_reviewed" : true,
    "github_reviewed_at" : "2024-02-28T22:57:26Z",
    "nvd_published_at" : "2024-02-29T00:15:51Z"
  }
}