CVE-2026-34785 Rack: Local file inclusion in `Rack::Static` via URL Prefix Matching

High 7.5 Published Updated

Attackers can read sensitive files by exploiting prefix matching in Rack::Static, requiring specific configuration to expose unintended files.

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-34785?

CVE-2026-34785 is a high-severity path traversal 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::Static determines whether a request should be served as a static file using a simple string prefix check. When configured with URL prefixes such as "/css", it matches any request path that begins with that string, including unrelated paths such as "/css-config.env" or "/css-backup.sql". As a result, files under the static root whose names merely share the configured prefix may be served unintentionally, leading to information disclosure. This issue has been patched in versions 2.2.23, 3.1.21, and 3.2.6.

Weakness: CWE-552, CWE-200, CWE-187

Which versions are affected by CVE-2026-34785?

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-34785?

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

Upgrade, and resolve every user-supplied path against an allowed base folder before opening it. More about Path traversal.

Is CVE-2026-34785 being exploited?

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

Sources

Also known as DEBIAN-CVE-2026-34785, GHSA-h2jq-g4cq-5ppq, MINI-2rjv-48v3-hp9w, MINI-2vpc-fx7j-9jqx, MINI-3r9g-3cm3-m7hr, MINI-3vmh-r8r5-pgpr and 21 more.

Is CVE-2026-34785 in your software?

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

Check your SBOMs for free