Vulnerability GHSA-q2ww-5357-x388

Medium Risk
MEDIUM RISK
CVSS Score: 4.8
Score Range: 4.0–6.9
Medium severity vulnerabilities (CVSS 4.0–6.9). Important issues that meaningfully reduce security confidence.
7 months ago
April 02, 2026 at 08:36 PM UTC
Rack has Content-Length mismatch in Rack::Files error responses
0.1.0 - 0.4.0 and 0.9.0 - 1.1.0 and 1.1.1.pre and 1.1.1 - 1.2.8 and 1.3.0.beta and 1.3.0.beta2 and 1.3.0 - 1.4.7 and 1.5.0.beta.1 and 1.5.0.beta.2 and 1.5.0 - 1.5.5 and 1.6.0.beta and 1.6.0.beta2 and 1.6.0 - 1.6.13 and 2.0.0.alpha and 2.0.0.rc1 and 2.0.1 - 2.0.9 and 2.0.9.1 and 2.0.9.2 and 2.0.9.3 and 2.0.9.4 and 2.1.0 - 2.1.4 and 2.1.4.1 and 2.1.4.2 and 2.1.4.3 and 2.1.4.4 and 2.2.0 - 2.2.3 and 2.2.3.1 and 2.2.4 - 2.2.6 and 2.2.6.1 and 2.2.6.2 and 2.2.6.3 and 2.2.6.4 and 2.2.7 - 2.2.8 and 2.2.8.1 and 2.2.9 - 2.2.22 and 3.0.0.beta1 and 3.0.0.rc1 and 3.0.0 - 3.0.4 and 3.0.4.1 and 3.0.4.2 and 3.0.5 - 3.0.6 and 3.0.6.1 and 3.0.7 - 3.0.9 and 3.0.9.1 and 3.0.10 - 3.2.5
0.1.0 - 0.4.0 and 0.9.0 - 1.1.0 and 1.1.1.pre and 1.1.1 - 1.2.8 and 1.3.0.beta and 1.3.0.beta2 and 1.3.0 - 1.4.7 and 1.5.0.beta.1 and 1.5.0.beta.2 and 1.5.0 - 1.5.5 and 1.6.0.beta and 1.6.0.beta2 and 1.6.0 - 1.6.13 and 2.0.0.alpha and 2.0.0.rc1 and 2.0.1 - 2.0.9 and 2.0.9.1 and 2.0.9.2 and 2.0.9.3 and 2.0.9.4 and 2.1.0 - 2.1.4 and 2.1.4.1 and 2.1.4.2 and 2.1.4.3 and 2.1.4.4 and 2.2.0 - 2.2.3 and 2.2.3.1 and 2.2.4 - 2.2.6 and 2.2.6.1 and 2.2.6.2 and 2.2.6.3 and 2.2.6.4 and 2.2.7 - 2.2.8 and 2.2.8.1 and 2.2.9 - 2.2.22 and 3.0.0.beta1 and 3.0.0.rc1 and 3.0.0 - 3.0.4 and 3.0.4.1 and 3.0.4.2 and 3.0.5 - 3.0.6 and 3.0.6.1 and 3.0.7 - 3.0.9 and 3.0.9.1 and 3.0.10 - 3.2.5

Summary

Rack has Content-Length mismatch in Rack::Files error responses

Details

Summary

Rack::Files#fail sets the Content-Length response header using String#size instead of String#bytesize. When the response body contains multibyte UTF-8 characters, the declared Content-Length is smaller than the number of bytes actually sent on the wire.

Because Rack::Files reflects the requested path in 404 responses, an attacker can trigger this mismatch by requesting a non-existent path containing percent-encoded UTF-8 characters.

This results in incorrect HTTP response framing and may cause response desynchronization in deployments that rely on the incorrect Content-Length value.

Details

Rack::Files#fail constructs error responses using logic equivalent to:

def fail(status, body, headers = {})
  body += "\n"
  [
    status,
    {
      "content-type" => "text/plain",
      "content-length" => body.size.to_s,
      "x-cascade" => "pass"
    }.merge!(headers),
    [body]
  ]
end

Here, body.size returns the number of characters, not the number of bytes. For multibyte UTF-8 strings, this produces an incorrect Content-Length value.

Rack::Files includes the decoded request path in 404 responses. A request containing percent-encoded UTF-8 path components therefore causes the response body to contain multibyte characters, while the Content-Length header still reflects character count rather than byte count.

As a result, the server can send more bytes than declared in the response headers.

This violates HTTP message framing requirements, which define Content-Length as the number of octets in the message body.

Impact

Applications using Rack::Files may emit incorrectly framed error responses when handling requests for non-existent paths containing multibyte characters.

In some deployment topologies, particularly with keep-alive connections and intermediaries that rely on Content-Length, this mismatch may lead to response parsing inconsistencies or response desynchronization. The practical exploitability depends on the behavior of downstream proxies, clients, and connection reuse.

Even where no secondary exploitation is possible, the response is malformed and may trigger protocol errors in strict components.

Mitigation

  • Update to a patched version of Rack that computes Content-Length using String#bytesize.
  • Avoid exposing Rack::Files directly to untrusted traffic until a fix is available, if operationally feasible.
  • Where possible, place Rack behind a proxy or server that normalizes or rejects malformed backend responses.
  • Prefer closing backend connections on error paths if response framing anomalies are a concern.

Related Vulnerabilities

Other vulnerabilities affecting the same packages

High Risk
9 hours ago
Rack: Multipart parsing allows DoS via unbounded scan buffer growth
0.1.0 - 0.4.0 and 0.9.0 - 1.1.0 and 1.1.1.pre and 1.1.1 - 1.2.8 and 1.3.0.beta and 1.3.0.beta2 and 1.3.0 - 1.4.7 and 1.5.0.beta.1 and 1.5.0.beta.2 and 1.5.0 - 1.5.5 and 1.6.0.beta and 1.6.0.beta2 and 1.6.0 - 1.6.13 and 2.0.0.alpha and 2.0.0.rc1 and 2.0.1 - 2.0.9 and 2.0.9.1 and 2.0.9.2 and 2.0.9.3 and 2.0.9.4 and 2.1.0 - 2.1.4 and 2.1.4.1 and 2.1.4.2 and 2.1.4.3 and 2.1.4.4 and 2.2.0 - 2.2.3 and 2.2.3.1 and 2.2.4 - 2.2.6 and 2.2.6.1 and 2.2.6.2 and 2.2.6.3 and 2.2.6.4 and 2.2.7 - 2.2.8 and 2.2.8.1 and 2.2.9 - 3.0.4 and 3.0.4.1 and 3.0.4.2 and 3.0.5 - 3.0.6 and 3.0.6.1 and 3.0.7 - 3.0.9 and 3.0.9.1 and 3.0.10 - 3.2.7 GHSA-5v64-555j-wjxm
0.1.0 - 0.4.0 and 0.9.0 - 1.1.0 and 1.1.1.pre and 1.1.1 - 1.2.8 and 1.3.0.beta and 1.3.0.beta2 and 1.3.0 - 1.4.7 and 1.5.0.beta.1 and 1.5.0.beta.2 and 1.5.0 - 1.5.5 and 1.6.0.beta and 1.6.0.beta2 and 1.6.0 - 1.6.13 and 2.0.0.alpha and 2.0.0.rc1 and 2.0.1 - 2.0.9 and 2.0.9.1 and 2.0.9.2 and 2.0.9.3 and 2.0.9.4 and 2.1.0 - 2.1.4 and 2.1.4.1 and 2.1.4.2 and 2.1.4.3 and 2.1.4.4 and 2.2.0 - 2.2.3 and 2.2.3.1 and 2.2.4 - 2.2.6 and 2.2.6.1 and 2.2.6.2 and 2.2.6.3 and 2.2.6.4 and 2.2.7 - 2.2.8 and 2.2.8.1 and 2.2.9 - 3.0.4 and 3.0.4.1 and 3.0.4.2 and 3.0.5 - 3.0.6 and 3.0.6.1 and 3.0.7 - 3.0.9 and 3.0.9.1 and 3.0.10 - 3.2.7 GHSA-5v64-555j-wjxm
Low Risk
9 hours ago
Rack: Multipart boundary ambiguity guard in Rack::Multipart::Parser can be bypassed with a quoted boundary value, allowing WAF bypass
0.1.0 - 0.4.0 and 0.9.0 - 1.1.0 and 1.1.1.pre and 1.1.1 - 1.2.8 and 1.3.0.beta and 1.3.0.beta2 and 1.3.0 - 1.4.7 and 1.5.0.beta.1 and 1.5.0.beta.2 and 1.5.0 - 1.5.5 and 1.6.0.beta and 1.6.0.beta2 and 1.6.0 - 1.6.13 and 2.0.0.alpha and 2.0.0.rc1 and 2.0.1 - 2.0.9 and 2.0.9.1 and 2.0.9.2 and 2.0.9.3 and 2.0.9.4 and 2.1.0 - 2.1.4 and 2.1.4.1 and 2.1.4.2 and 2.1.4.3 and 2.1.4.4 and 2.2.0 - 2.2.3 and 2.2.3.1 and 2.2.4 - 2.2.6 and 2.2.6.1 and 2.2.6.2 and 2.2.6.3 and 2.2.6.4 and 2.2.7 - 2.2.8 and 2.2.8.1 and 2.2.9 - 3.0.4 and 3.0.4.1 and 3.0.4.2 and 3.0.5 - 3.0.6 and 3.0.6.1 and 3.0.7 - 3.0.9 and 3.0.9.1 and 3.0.10 - 3.2.7 GHSA-p8x9-v4hv-2w4g
0.1.0 - 0.4.0 and 0.9.0 - 1.1.0 and 1.1.1.pre and 1.1.1 - 1.2.8 and 1.3.0.beta and 1.3.0.beta2 and 1.3.0 - 1.4.7 and 1.5.0.beta.1 and 1.5.0.beta.2 and 1.5.0 - 1.5.5 and 1.6.0.beta and 1.6.0.beta2 and 1.6.0 - 1.6.13 and 2.0.0.alpha and 2.0.0.rc1 and 2.0.1 - 2.0.9 and 2.0.9.1 and 2.0.9.2 and 2.0.9.3 and 2.0.9.4 and 2.1.0 - 2.1.4 and 2.1.4.1 and 2.1.4.2 and 2.1.4.3 and 2.1.4.4 and 2.2.0 - 2.2.3 and 2.2.3.1 and 2.2.4 - 2.2.6 and 2.2.6.1 and 2.2.6.2 and 2.2.6.3 and 2.2.6.4 and 2.2.7 - 2.2.8 and 2.2.8.1 and 2.2.9 - 3.0.4 and 3.0.4.1 and 3.0.4.2 and 3.0.5 - 3.0.6 and 3.0.6.1 and 3.0.7 - 3.0.9 and 3.0.9.1 and 3.0.10 - 3.2.7 GHSA-p8x9-v4hv-2w4g
Medium Risk
9 hours ago
Rack: Rack::Request#host_with_port (and #base_url / #url) return the raw invalid Host header — incomplete fix of CVE-2026-34835
3.0.0 - 3.0.4 and 3.0.4.1 and 3.0.4.2 and 3.0.5 - 3.0.6 and 3.0.6.1 and 3.0.7 - 3.0.9 and 3.0.9.1 and 3.0.10 - 3.2.7 GHSA-2j8w-xcrc-x985
3.0.0 - 3.0.4 and 3.0.4.1 and 3.0.4.2 and 3.0.5 - 3.0.6 and 3.0.6.1 and 3.0.7 - 3.0.9 and 3.0.9.1 and 3.0.10 - 3.2.7 GHSA-2j8w-xcrc-x985
Medium Risk
10 hours ago
Rack: Rack::Static header_rules bypass via dot-segment normalization mismatch
0.1.0 - 0.4.0 and 0.9.0 - 1.1.0 and 1.1.1.pre and 1.1.1 - 1.2.8 and 1.3.0.beta and 1.3.0.beta2 and 1.3.0 - 1.4.7 and 1.5.0.beta.1 and 1.5.0.beta.2 and 1.5.0 - 1.5.5 and 1.6.0.beta and 1.6.0.beta2 and 1.6.0 - 1.6.13 and 2.0.0.alpha and 2.0.0.rc1 and 2.0.1 - 2.0.9 and 2.0.9.1 and 2.0.9.2 and 2.0.9.3 and 2.0.9.4 and 2.1.0 - 2.1.4 and 2.1.4.1 and 2.1.4.2 and 2.1.4.3 and 2.1.4.4 and 2.2.0 - 2.2.3 and 2.2.3.1 and 2.2.4 - 2.2.6 and 2.2.6.1 and 2.2.6.2 and 2.2.6.3 and 2.2.6.4 and 2.2.7 - 2.2.8 and 2.2.8.1 and 2.2.9 - 3.0.4 and 3.0.4.1 and 3.0.4.2 and 3.0.5 - 3.0.6 and 3.0.6.1 and 3.0.7 - 3.0.9 and 3.0.9.1 and 3.0.10 - 3.2.7 GHSA-wvg4-6p58-3gh3
0.1.0 - 0.4.0 and 0.9.0 - 1.1.0 and 1.1.1.pre and 1.1.1 - 1.2.8 and 1.3.0.beta and 1.3.0.beta2 and 1.3.0 - 1.4.7 and 1.5.0.beta.1 and 1.5.0.beta.2 and 1.5.0 - 1.5.5 and 1.6.0.beta and 1.6.0.beta2 and 1.6.0 - 1.6.13 and 2.0.0.alpha and 2.0.0.rc1 and 2.0.1 - 2.0.9 and 2.0.9.1 and 2.0.9.2 and 2.0.9.3 and 2.0.9.4 and 2.1.0 - 2.1.4 and 2.1.4.1 and 2.1.4.2 and 2.1.4.3 and 2.1.4.4 and 2.2.0 - 2.2.3 and 2.2.3.1 and 2.2.4 - 2.2.6 and 2.2.6.1 and 2.2.6.2 and 2.2.6.3 and 2.2.6.4 and 2.2.7 - 2.2.8 and 2.2.8.1 and 2.2.9 - 3.0.4 and 3.0.4.1 and 3.0.4.2 and 3.0.5 - 3.0.6 and 3.0.6.1 and 3.0.7 - 3.0.9 and 3.0.9.1 and 3.0.10 - 3.2.7 GHSA-wvg4-6p58-3gh3
Medium Risk
7 months ago
Rack::Request accepts invalid Host characters, enabling host allowlist bypass
3.0.0.beta1 and 3.0.0.rc1 and 3.0.0 - 3.0.4 and 3.0.4.1 and 3.0.4.2 and 3.0.5 - 3.0.6 and 3.0.6.1 and 3.0.7 - 3.0.9 and 3.0.9.1 and 3.0.10 - 3.2.5 GHSA-g2pf-xv49-m2h5
3.0.0.beta1 and 3.0.0.rc1 and 3.0.0 - 3.0.4 and 3.0.4.1 and 3.0.4.2 and 3.0.5 - 3.0.6 and 3.0.6.1 and 3.0.7 - 3.0.9 and 3.0.9.1 and 3.0.10 - 3.2.5 GHSA-g2pf-xv49-m2h5
View all vulnerabilities for these packages

Impacted packages

Timeline

Published
7 months ago
April 02, 2026 at 08:36 PM UTC
Fixed (2.2.23)
7 months ago
April 01, 2026 at 06:34 AM UTC
Fixed (3.1.21)
7 months ago
April 01, 2026 at 06:35 AM UTC
Fixed (3.2.6)
7 months ago
April 01, 2026 at 06:36 AM UTC
Last Modified
2 months ago
September 10, 2026 at 03:51 AM UTC