Content-Length Mismatch in Rack Web Server Interface Affecting Multiple Versions
CVE-2026-34831
What is CVE-2026-34831?
The Rack web server interface, utilized extensively within Ruby applications, has encountered a flaw in its response handling. Prior to the patched versions (2.2.23, 3.1.21, and 3.2.6), the function Rack::Files#fail incorrectly set the Content-Length response header using String#size, leading to a discrepancy when multibyte UTF-8 characters were included in the response body. This flaw permits attackers to exploit 404 responses by leveraging percent-encoded UTF-8 strings, which can cause response desynchronization in environments dependent on the inaccurate Content-Length value. This issue has been resolved in the latest versions.
Affected Version(s)
rack < 2.2.23 < 2.2.23
rack >= 3.0.0.beta1, < 3.1.21 < 3.0.0.beta1, 3.1.21
rack >= 3.2.0, < 3.2.6 < 3.2.0, 3.2.6
