CVE-2026-34831 Rack: Content-Length mismatch in Rack::Files error responses

Medium 4.8 Published Updated

An attacker can cause HTTP response desynchronization in Rack::Files by exploiting a Content-Length mismatch with multibyte UTF-8 characters in 404 responses.

Exploited in the wild
Not known
Login needed
Not needed
Attackable
Over the internet
Victim action needed
Not needed
Fix
Available

What is CVE-2026-34831?

CVE-2026-34831 is a medium-severity vulnerability in rack, published on 2 Apr 2026. An attacker can exploit it over the internet without logging in, with no action from the victim.

Official description

Rack is a modular Ruby web server interface. Prior to versions 2.2.23, 3.1.21, and 3.2.6, 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. This issue has been patched in versions 2.2.23, 3.1.21, and 3.2.6.

Weakness: CWE-135, CWE-130

Which versions are affected by CVE-2026-34831?

6 open source packages ship an affected version, including rack. It affects 1 product.

PackageAffectedFixed in
rack RubyGemsAll versions2.2.23
rack RubyGemsAll versions2.2.23
rack RubyGemsFrom 3.0.0.beta13.1.21
rack RubyGemsFrom 3.0.0.beta13.1.21
rack RubyGemsFrom 3.2.03.2.6
rack RubyGemsFrom 3.2.03.2.6

Products include Rack Rack.

How do I fix CVE-2026-34831?

Upgrade rack to a fixed version for your release line: 2.2.23, 3.1.21 or 3.2.6.

Is CVE-2026-34831 being exploited?

There is no known exploitation of CVE-2026-34831 in the wild and no public exploit code.

Sources

Also known as DEBIAN-CVE-2026-34831, GHSA-q2ww-5357-x388, MINI-23x3-g4pr-hqx5, MINI-2vjr-2xj3-mp4g, MINI-373h-wh2v-6f8v, MINI-3vvp-422v-m53w and 21 more.

Is CVE-2026-34831 in your software?

Upload an SBOM and sbomify checks it against every vulnerability here, every day.

Check your SBOMs for free