CVE-2026-34786: Rack Rack::Static security header bypass via URL-encoded paths

CVE-2026-34786 · Severity: medium · CVSS 5.3 · Published 2026-04-02

Rack is a widely used interface for Ruby web applications that helps manage how web servers and applications communicate. A flaw in its static file handling component allows attackers to bypass security headers (such as those protecting against clickjacking or data theft) by using specially formatted web addresses. This could result in sensitive files being served without the intended security protections, potentially exposing users or data to web-based attacks.

Technologies: rack (RubyGems). Vendors: RubyGems.

Quick answers

Is CVE-2026-34786 exploited in the wild?
No. Junglewise Threat Intelligence has no report of CVE-2026-34786 being exploited in the wild.
How severe is CVE-2026-34786?
Medium severity, with a CVSS score of 5.3, published 2 April 2026.
Which products and versions are affected?
rack (RubyGems) ECOSYSTEM:introduced=0,fixed=2.2.23.
Is there a fix for CVE-2026-34786?
Yes. rack (RubyGems): upgrade to 2.2.23 or later. Junglewise finds every place you run it, drafts the upgrade and applies it once you approve.
How is CVE-2026-34786 attacked?
It is attacked over the network, in a software library.
Am I affected by CVE-2026-34786?
Check whether you run rack (RubyGems) at an affected version. Junglewise does that check for you around the clock: connect your code, cloud and domains, and it matches new vulnerabilities like this one against what you actually run and tells you when one reaches you.

How to fix

  • rack (RubyGems): upgrade to 2.2.23 or later
    bundle update rack

Technical details

A canonicalization mismatch exists in Rack::Static#applicable_rules where header rules (such as :fonts, Array, or Regexp types) are evaluated against the raw, URL-encoded PATH_INFO. However, the underlying file-serving mechanism decodes the path before retrieving the file. An attacker can exploit this by requesting a URL-encoded version of a path (e.g., using %2E instead of a dot), which causes the header rules to fail to match while still serving the intended file. This results in the file being delivered without configured security headers like Content-Security-Policy or X-Frame-Options. The issue is fixed in versions 2.2.23, 3.1.21, and 3.2.6.

Affected products

  • Rack Rack < 2.2.23, >= 3.0.0.beta1 < 3.1.21, >= 3.2.0 < 3.2.6

Identifiers

  • CVE-2026-34786
  • GHSA-q4qf-9j86-f5mh

Timeline

  • 2026-04-01: advisory: GitHub Security Advisory published
  • 2026-04-02: disclosed: CVE published to NVD
  • 2026-04-02: patched: Patched versions released

References

This page as Markdown. Free to reuse under CC BY 4.0 with a link back.