CVE-2026-34763: Rack has a root directory disclosure via unescaped regex interpolation in Rack::Directory
Summary Rack::Directory interpolates the configured root path directly into a regular expression when deriving the displayed directory path. If root contains regex metacharacters such as +, , or ., the prefix stripping can fail and the generated directory listing may expose the full filesystem path in the HTML output.
Published Apr 2, 2026 · Updated May 13, 2026
Affected packages
rack
- Ecosystem
- RubyGems
- Affected
- < 2.2.23
- Fixed in
- 2.2.23
- Check
bundle info rack
rack
- Ecosystem
- RubyGems
- Affected
- >= 3.0.0.beta1, < 3.1.21
- Fixed in
- 3.1.21
- Check
bundle info rack
rack
- Ecosystem
- RubyGems
- Affected
- >= 3.2.0, < 3.2.6
- Fixed in
- 3.2.6
- Check
bundle info rack
Advisory details
From the GitHub Advisory Database (CC BY 4.0).
Summary
Rack::Directory interpolates the configured root path directly into a regular expression when deriving the displayed directory path. If root contains regex metacharacters such as +, *, or ., the prefix stripping can fail and the generated directory listing may expose the full filesystem path in the HTML output.
Details
Rack::Directory::DirectoryBody#each computes the visible path using code equivalent to:
show_path = Utils.escape_html(path.sub(/\A#{root}/, ''))Here, root is a developer-configured filesystem path. It is normalized earlier with File.expand_path(root) and then inserted directly into a regular expression without escaping.
Because the value is treated as regex syntax rather than as a literal string, metacharacters in the configured path can change how the prefix match behaves. When that happens, the expected root prefix is not removed from path, and the absolute filesystem path is rendered into the HTML directory listing.
Impact
If Rack::Directory is configured to serve a directory whose absolute path contains regex metacharacters, the generated directory listing may disclose the full server filesystem path instead of only the request-relative path.
This can expose internal deployment details such as directory layout, usernames, mount points, or naming conventions that would otherwise not be visible to clients.
Mitigation
- Update to a patched version of Rack in which the root prefix is removed using an escaped regular expression.
- Avoid using
Rack::Directorywith a root path that contains regular expression metacharacters.
Credited to harukioya, ioquatix, jeremyevans.
References
How this page is made: the data panel comes from the GitHub Advisory Database, CISA’s KEV catalog, the NVD and FIRST EPSS, and updates twice a day. No analysis has been written for this entry yet. Methodology
More RubyGems vulnerabilities
All RubyGems entriesCVE-2026-125108
Rack: Multipart boundary ambiguity guard in Rack::Multipart::Parser can be bypassed with a quoted boundary value, allowing WAF bypass
low3.7Nov 10, 2026CVE-2026-125109
Rack: Rack::Request#host_with_port (and #base_url / #url) return the raw invalid Host header — incomplete fix of CVE-2026-34835
medium4.8Nov 10, 2026CVE-2026-125110
Rack: Rack::Static header_rules bypass via dot-segment normalization mismatch
medium5.3Nov 10, 2026CVE-2026-125111
Rack: Multipart parsing allows DoS via unbounded scan buffer growth
high7.5Nov 10, 2026CVE-2026-26961
Rack's greedy multipart boundary parsing can cause parser differentials and WAF bypass.
medium5.3Apr 2, 2026CVE-2026-26962
Rack's improper unfolding of folded multipart headers preserves CRLF in parsed parameter values
medium4.8Apr 2, 2026
