CVEReports
CVEReports

Automated vulnerability intelligence platform. Comprehensive reports for high-severity CVEs generated by AI.

Product

  • Home
  • Sitemap
  • RSS Feed

Company

  • About
  • Contact
  • Privacy Policy
  • Terms of Service

© 2026 CVEReports. All rights reserved.

Made with love by Amit Schendel & Alon Barad



CVE-2026-34785

CVE-2026-34785: Information Disclosure via Partial String Comparison in Rack::Static

Alon Barad
Alon Barad
Software Engineer

Apr 2, 2026·6 min read·62 visits

Executive Summary (TL;DR)

A partial string matching flaw in Rack::Static allows unauthenticated attackers to retrieve unintended files sharing a text prefix with static directories. Updating to patched versions resolves the issue.

Rack, a foundational Ruby web server interface, suffers from an information disclosure vulnerability in its Rack::Static middleware prior to versions 2.2.23, 3.1.21, and 3.2.6. The vulnerability arises from an insecure partial string comparison logic flaw in the URL routing mechanism, allowing attackers to access sensitive files that inadvertently share a common prefix with configured static asset directories.

Vulnerability Overview

Rack serves as a foundational modular interface for Ruby web applications, bridging various web frameworks and application servers. The Rack::Static middleware provides a convenient mechanism for serving static files, such as stylesheets, JavaScript, and images, directly from a specified root directory on the filesystem. Developers configure this middleware by defining an array of URL prefixes that trigger static file resolution.

CVE-2026-34785 represents an information disclosure vulnerability within this routing mechanism, categorized under CWE-187 (Partial String Comparison) and CWE-200 (Exposure of Sensitive Information). The flaw exists in Rack versions prior to 2.2.23, 3.1.21, and 3.2.6. It allows unauthenticated remote attackers to access unintended files located within the configured static root directory.

The vulnerability manifests when the middleware attempts to match incoming request paths against the configured static URL prefixes. Because the implementation relies on a basic string prefix check without enforcing directory boundaries, attackers can request files that merely share a text prefix with a legitimate static directory. This results in the server returning files that were never intended for public exposure.

Root Cause Analysis

The core of the vulnerability resides in the route_file method of the Rack::Static class. This method evaluates whether an incoming HTTP request path should be processed by the static file handler. The evaluation logic relies on the String#index method to determine if the request path begins with any of the configured URL prefixes.

The vulnerable implementation uses the condition path.index(url) == 0, which is functionally equivalent to the start_with? method in Ruby. This approach verifies only that the sequence of characters in the request path begins with the exact character sequence defined in the configuration. It does not verify that the prefix represents a complete path segment terminating in a forward slash (/).

Consequently, if a developer configures Rack::Static to serve files from the /css URL prefix, the routing logic will intercept any request path beginning with those four characters. A request for /css-config.env will yield an index of 0 when evaluated against the /css prefix. The middleware incorrectly determines that it should handle the request and proceeds to locate and serve the requested file from the static root directory.

Code Analysis

Analyzing the source code before and after commit 7a8f32696609b88e2c4c1f09d473a1d2d837ed4b highlights the precise mechanism of the vulnerability and its resolution. The vulnerable route_file method contained a single line of logic for prefix matching:

def route_file(path)
  @urls.kind_of?(Array) && @urls.any? { |url| path.index(url) == 0 }
end

The patch addresses this logic flaw by introducing a strict boundary check during the initialization phase of the middleware. The urls configuration array is transformed to store a tuple for each prefix, consisting of the exact original prefix and a version explicitly terminated with a forward slash:

if @urls.kind_of?(Array)
  @urls = @urls.map { |url| [url, url.end_with?('/') ? url : "#{url}/".freeze].freeze }.freeze
end

The route_file method was subsequently rewritten to utilize these tuples. The new logic evaluates whether the request path exactly matches the configured prefix or if it starts with the slash-terminated version:

def route_file(path)
  @urls.kind_of?(Array) && @urls.any? { |url, url_slash| path == url || path.start_with?(url_slash) }
end

This structural change ensures that a request for /css-backup.sql no longer matches the /css configuration. The path does not exactly equal /css, nor does it start with the boundary-enforced string /css/. The middleware will decline to handle the request, passing it down the Rack stack or returning an appropriate HTTP error.

Exploitation Mechanics

Exploiting this vulnerability requires specific environmental prerequisites. The target application must utilize the Rack::Static middleware and explicitly define an array of URL prefixes via the :urls configuration option. Furthermore, a sensitive file or directory must reside within the designated static :root directory and possess a name that shares a literal string prefix with one of the configured URLs.

An attacker initiates the exploit by mapping the application's expected static asset paths. By observing the HTML source or network traffic, the attacker identifies prefixes such as /assets, /css, or /js. The attacker then formulates HTTP GET requests targeting common sensitive file names appended directly to these prefixes, bypassing the directory separator.

# Proof of Concept targeting a database backup file
curl -v http://target-app.internal/css-backup.sql

The following diagram illustrates the execution flow during an exploitation attempt:

Upon receiving the crafted request, the Rack application routes it to the Rack::Static middleware. The middleware validates the prefix, locates the corresponding file on the local filesystem within the static root, and returns its contents to the unauthenticated attacker.

Impact Assessment

The primary impact of CVE-2026-34785 is the unauthorized disclosure of sensitive information. The vulnerability permits an attacker to read the contents of files located within the configured static root directory. The severity of the disclosure depends entirely on the operational practices of the deployment environment and the types of files inadvertently placed alongside public assets.

This vulnerability does not facilitate arbitrary file reading or path traversal attacks against the underlying operating system. The Rack::Static middleware still enforces constraints that prevent access to files outside the defined :root directory. Attackers cannot read /etc/passwd or application source code located completely outside the static assets folder. The exposure is strictly limited to siblings of the intended static directories.

Commonly exposed data includes database backup files, unminified source code, environment variable configuration files, and local deployment artifacts. The CVSS v3.1 vector CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:N/A:N accurately reflects a high severity rating for confidentiality impact, with low attack complexity and no requirement for user interaction or prior authentication.

Remediation and Mitigation

The primary remediation for CVE-2026-34785 requires updating the rack gem to a patched version. Maintainers have released fixes in Rack versions 2.2.23, 3.1.21, and 3.2.6. Development teams should update their dependency manifests and deploy the updated gem to all environments utilizing the Rack::Static middleware.

If immediate patching is technically prohibitive, administrators can implement a configuration-based workaround. Modifying the Rack::Static initialization to include a trailing slash in all configured URL prefixes prevents the partial string match. Changing :urls => ["/css"] to :urls => ["/css/"] manually enforces the directory boundary that the patched code handles automatically.

Organizations should also enforce strict segregation of public assets and sensitive files. Deployment pipelines must ensure that database backups, environment configuration files, and uncompiled application source code are never placed within directories designated for public static file serving. Implementing automated directory structure linting can prevent inadvertent co-location of these assets.

Official Patches

Rack ProjectOfficial fix commit in the rack repository

Fix Analysis (1)

Technical Appendix

CVSS Score
7.5/ 10
CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:N/A:N

Affected Systems

Ruby applications using the Rack library (< 2.2.23, 3.0.0.beta1 - 3.1.20, 3.2.0 - 3.2.5)Applications utilizing Rack::Static for asset serving

Affected Versions Detail

Product
Affected Versions
Fixed Version
Rack
Rack Project
< 2.2.232.2.23
Rack
Rack Project
>= 3.0.0.beta1, < 3.1.213.1.21
Rack
Rack Project
>= 3.2.0, < 3.2.63.2.6
AttributeDetail
CWE IDCWE-187 (Partial String Comparison)
Attack VectorNetwork
CVSS Score7.5 (High)
ImpactConfidentiality (High)
Exploit StatusProof of Concept
CISA KEVNo

MITRE ATT&CK Mapping

T1005Data from Local System
Collection
T1552Unsecured Credentials
Credential Access
CWE-187
Partial String Comparison

The application performs a string comparison that does not verify that a match is exact or adheres to expected boundaries, leading to unauthorized operations.

Vulnerability Timeline

Official fix committed to the rack repository.
2026-03-06
Rack v3.2.6 released containing the fix.
2026-04-01
Vulnerability publicly disclosed and CVE-2026-34785 assigned.
2026-04-02

References & Sources

  • [1]GitHub Security Advisory: GHSA-h2jq-g4cq-5ppq
  • [2]CVE Record: CVE-2026-34785
  • [3]Fix Commit: 7a8f32696609b88e2c4c1f09d473a1d2d837ed4b
  • [4]NVD Detail: CVE-2026-34785

Attack Flow Diagram

Press enter or space to select a node. You can then use the arrow keys to move the node around. Press delete to remove it and escape to cancel.
Press enter or space to select an edge. You can then press delete to remove it or escape to cancel.

More Reports

•40 minutes ago•CVE-2026-71322
4.3

CVE-2026-71322: Missing Authorization Check in Netflix Lemur Certificate Export

Netflix Lemur, a TLS/SSL certificate management framework, contains a missing authorization check in its certificate export endpoint. Prior to version 1.9.3, the validation logic verifying whether a user had permission to export a certificate was incorrectly placed inside a block that executed only if the selected plugin required a private key. When an authenticated user attempted to export a certificate using a plugin that did not require the private key, the authorization check was bypassed, allowing unauthorized access to the public portions of the certificate and producing misleading audit logs.

Alon Barad
Alon Barad
0 views•6 min read
•about 2 hours ago•GHSA-JF24-8G2H-2WG7
7.2

GHSA-JF24-8G2H-2WG7: Remote Code Execution in LibreNMS AboutController via Binary Path Substitution

A critical security flaw in LibreNMS allows authenticated administrators to execute arbitrary commands by modifying the configured binary path for snmpget and accessing the About page. This occurs due to insufficient verification of the executable file's identity and integrity prior to executing it with shell_exec.

Amit Schendel
Amit Schendel
1 views•6 min read
•about 3 hours ago•GHSA-7CJ5-V4PP-V632
4.8

GHSA-7cj5-v4pp-v632: Stored Cross-Site Scripting in LibreNMS Graph Descriptions

LibreNMS versions prior to 26.7.0 are vulnerable to a stored Cross-Site Scripting (XSS) vulnerability. An authenticated administrator can inject arbitrary HTML or JavaScript into graph descriptions via specific administrative configuration endpoints. When another authenticated user views the affected graph, the unescaped payload executes within their browser context.

Alon Barad
Alon Barad
2 views•5 min read
•about 4 hours ago•GHSA-7GWW-X7FH-JF9J
8.1

GHSA-7GWW-X7FH-JF9J: SSRF-Driven Stored Cross-Site Scripting in LibreNMS Oxidized Integration

An injection vulnerability in LibreNMS's Oxidized integration component allows administrative or network-positioned attackers to achieve stored cross-site scripting (XSS). By setting a malicious oxidized.url endpoint, the server makes outbound queries and processes returned JSON fields containing malicious HTML or JavaScript. These payloads are outputted directly in the web UI without appropriate output encoding.

Amit Schendel
Amit Schendel
2 views•6 min read
•about 5 hours ago•CVE-2026-17106
7.1

CVE-2026-17106: Container-to-Host Arbitrary File Write in moby/go-archive (CopyEscape)

CVE-2026-17106 (CopyEscape) is a container-to-host arbitrary file-write vulnerability within Docker's archiving and extraction library moby/go-archive. By utilizing a Time-of-Check to Time-of-Use (TOCTOU) race condition during the file-walking stage inside a running container, a malicious container process can force the host engine to produce a compromised tar stream. During client-side extraction, the Docker CLI resolves directory entries through absolute symbolic links, resulting in arbitrary file creation or modification on the host system.

Amit Schendel
Amit Schendel
4 views•6 min read
•about 6 hours ago•CVE-2026-73974
5.5

CVE-2026-73974: Local Path Traversal and Privilege Escalation in Linuxfabrik Monitoring Plugins

CVE-2026-73974 is a local path traversal vulnerability in linuxfabrik-lib and Linuxfabrik Monitoring Plugins. Under standard monitoring configurations running with elevated privileges via sudo, this flaw can be exploited by an unprivileged local user to read arbitrary root-only files, resulting in local privilege escalation.

Alon Barad
Alon Barad
4 views•5 min read