Advisory

GHSA-22f2-v57c-j9cx

Also known as: CVE-2024-25126

Summary

Rack vulnerable to ReDoS in content type parsing (2nd degree polynomial)

Details

Summary

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:

request["Content-Type"] = (" " * 50_000) + "a,"

Impact

It's a very easy to craft ReDoS. Like all ReDoS the impact is debatable.

Severity

Medium Basis: The source's own band: MODERATE

Dates

Published
2024-02-28 22:57 UTC
Modified
2026-09-10 03:50 UTC

Affected packages and fixes

rack

RubyGems · All systems

Affected

  • introduced 3.0.0, fixed 3.0.9.1 (ecosystem)

Fixed versions

3.0.9.1

Fix

The export has no generic command for this ecosystem.

rack

RubyGems · All systems

Affected

  • introduced 0.4, fixed 2.2.8.1 (ecosystem)

Fixed versions

2.2.8.1

Fix

The export has no generic command for this ecosystem.

Fix commands are the export's own generic commands. Ojuju never runs them. Check them against your setup first.

Check your own computer: guard packages check

View this record on OSV.dev

Source

Source: GitHub Advisory Database (reviewed advisories) · CC BY 4.0

Sources & licences