Dec 4, 2026·11 min read·6 visits
Rack::Directory validates incoming request paths containing '..' segments using lexical expansion (File.expand_path), which ignores symbolic links, before passing the unnormalized path string directly to OS filesystem calls (File.stat and Dir.foreach). If the served root contains a symbolic link pointing to an external directory, an unauthenticated attacker can append '/..' sequences to traverse out of the symlink target and list directories outside the web root.
CVE-2026-142593 is a path traversal and improper symbolic link resolution vulnerability in the Rack::Directory middleware of the Rack Ruby web server interface. A discrepancy between lexical path validation in Ruby user space and physical path resolution by the operating system kernel allows unauthenticated remote attackers to bypass document root restrictions when a symlinked directory exists inside the served root. Attackers can enumerate file names, directory structures, file sizes, and modification timestamps outside the intended document root.
Rack is the foundational modular web server interface for Ruby, providing a minimal API between web servers that support Ruby and Ruby web frameworks such as Ruby on Rails, Sinatra, and Hanami. Within the Rack distribution, Rack::Directory is a built-in middleware component responsible for serving directory listings and delegating static file retrieval to an underlying file handler (Rack::Files by default). When a client requests a URI corresponding to a filesystem directory inside the configured document root (@root), Rack::Directory generates an HTML index page enumerating the directory's entries, file sizes, MIME types, and last-modified timestamps.
CVE-2026-142593 (also tracked as GHSA-mhj6-xc86-54m8) is a path traversal and symbolic link resolution vulnerability affecting Rack::Directory in Rack versions >= 2.2.0, < 2.2.26, >= 3.0.0, < 3.1.24, and >= 3.2.0, < 3.2.9. The vulnerability is classified under CWE-22 (Improper Limitation of a Pathname to a Restricted Directory) and CWE-59 (Improper Link Resolution Before File Access). Prior to Rack 2.2.0, Rack::Directory rejected all request paths containing dot-dot (..) segments unconditionally; however, changes introduced in the 2.2.0 cycle replaced that strict rejection with a boundary validation check using Ruby's File.expand_path.
When Rack::Directory serves a document root that contains a symbolic link pointing to a directory located elsewhere on the host filesystem, a semantic discrepancy occurs between how Rack::Directory validates the path and how the operating system kernel opens the directory. Specifically, the boundary validation resolves .. segments lexically without inspecting the filesystem, whereas subsequent directory listing routines pass the unnormalized path string containing .. directly to POSIX filesystem calls (stat and opendir).
Consequently, an unauthenticated remote attacker can send crafted HTTP GET requests containing /.. sequences immediately following a symlinked directory segment (for example, GET /symlink/../ or GET /symlink/../sibling_dir/). The operating system follows the symbolic link to its physical target first and then evaluates the .. segment relative to the target's real filesystem parent. This allows the attacker to escape the document root boundary and retrieve directory listings and file metadata from sibling and ancestor directories of the symlink target. Arbitrary file content disclosure does not occur through this vector because Rack::Files independently normalizes PATH_INFO via Rack::Utils.clean_path_info before opening files for reading.
The root cause of CVE-2026-142593 is the failure to canonicalize or normalize the user-supplied PATH_INFO string after performing lexical path boundary verification in Rack::Directory#get. Path resolution in software systems can operate in two distinct modes: lexical resolution, which treats a path purely as a string of slash-delimited tokens and collapses segment/.. pairs in memory, and physical resolution, where the operating system kernel traverses directory inodes on disk one component at a time, dereferencing symbolic links as they are encountered.
When Rack::Directory#get(env) processes an incoming HTTP request, it extracts and unescapes PATH_INFO, then invokes two validation helpers: check_bad_request(path_info) (which checks for null bytes) and check_forbidden(path_info). The check_forbidden method returns early if path_info does not contain ... If .. is present, check_forbidden calls File.expand_path(path_info, @root) and verifies that the resulting string still begins with @root. Crucially, Ruby's File.expand_path performs purely lexical string manipulation—it does not query the filesystem or call realpath(3) to resolve symbolic links.
Consider a deployment where @root is /var/app/current and /var/app/current/system is a symbolic link pointing to /var/app/shared/system. If a client requests /system/../config/, File.expand_path joins /var/app/current and system/../config, lexically collapsing system/.. to produce /var/app/current/config. Because /var/app/current/config starts with /var/app/current, check_forbidden concludes that the request remains confined within @root and returns nil (permitting the request).
Immediately after check_forbidden passes, Rack::Directory#get constructs the filesystem path using the original, unnormalized path_info string via ::File.join(@root, path_info), yielding "/var/app/current/system/../config". This raw string is passed into list_path, which invokes File.stat(path) and Dir.foreach(path). When the OS kernel executes the underlying stat and opendir system calls on "/var/app/current/system/../config", it walks the path physically: it first resolves /var/app/current/system to its target inode at /var/app/shared/system, and then resolves ../config relative to /var/app/shared/system, landing at /var/app/shared/config. A secondary manifestation of the same flaw exists in list_directory, where generating the Parent Directory (..) table row executes stat(::File.join(path, '..')), causing the kernel to stat the physical parent of the symlink target (/var/app/shared) rather than the logical parent in the document root (/var/app/current).
In the vulnerable implementation of lib/rack/directory.rb, Rack::Directory#get validates path_info but discards the normalized result, passing the raw path_info containing .. segments directly into ::File.join(@root, path_info). Furthermore, inside list_directory, the lambda passed to DirectoryBody.new computes file statistics for every directory entry—including the synthetic .. parent directory link—by joining path and basename directly.
# Vulnerable code in lib/rack/directory.rb (prior to patch)
def get(env)
script_name = env[SCRIPT_NAME]
path_info = Utils.unescape_path(env[PATH_INFO])
if client_error_response = check_bad_request(path_info) || check_forbidden(path_info)
client_error_response
else
# BUG 1: path_info still contains raw '..' components here.
# File.join preserves 'symlink/../sibling' for the OS kernel to resolve.
path = ::File.join(@root, path_info)
list_path(env, path, path_info, script_name)
end
end
def list_directory(path_info, path, script_name)
url_head = (script_name.split('/') + path_info.split('/')).map do |part|
Utils.escape_path(part)
end
body = DirectoryBody.new(@root, path, ->(basename) do
# BUG 2: When basename is '..', File.join(path, '..') asks the OS kernel
# to resolve '..' relative to the symlink target's physical path,
# leaking the mtime and size of the target's parent directory.
stat = stat(::File.join(path, basename))
next unless stat
...The upstream patch (committed as 42af7a7b10c54021e060e52c91a590a5d5f2a48d on main/v3.2, c7102e91e4a1ee832b006790de31b3d5b207b89e on v3.1, and d73bdad9e2ebec7217ecd3e9bbc079f076b0d120 on v2.2) addresses both issues in lib/rack/directory.rb with a two-line modification:
diff --git a/lib/rack/directory.rb b/lib/rack/directory.rb
index abcdef1..1234567 100644
--- a/lib/rack/directory.rb
+++ b/lib/rack/directory.rb
@@ -101,6 +101,7 @@ def get(env)
if client_error_response = check_bad_request(path_info) || check_forbidden(path_info)
client_error_response
else
+ path_info = Utils.clean_path_info(path_info)
path = ::File.join(@root, path_info)
list_path(env, path, path_info, script_name)
end
@@ -137,7 +138,7 @@ def list_directory(path_info, path, script_name)
# Globbing not safe as path could contain glob metacharacters
body = DirectoryBody.new(@root, path, ->(basename) do
- stat = stat(::File.join(path, basename))
+ stat = stat(basename == '..' ? ::File.dirname(path) : ::File.join(path, basename))
next unless stat
url = ::File.join(*url_head + [Utils.escape_path(basename)])First, the fix introduces path_info = Utils.clean_path_info(path_info) immediately before ::File.join(@root, path_info). Rack::Utils.clean_path_info splits the path on / and lexically collapses all . and .. entries in user space before any filesystem string is constructed. Consequently, a request for /system/../config/ is normalized to /config/ before File.join executes, aligning the filesystem lookup with the lexical validation performed by check_forbidden and matching the existing behavior of Rack::Files.
Second, when list_directory evaluates the Parent Directory entry (basename == '..'), the patch replaces ::File.join(path, '..') with ::File.dirname(path). Because File.dirname strips the trailing path component lexically in Ruby (File.dirname("/var/app/current/system") yields "/var/app/current") rather than passing "/var/app/current/system/.." to the kernel's stat syscall, the parent directory row now accurately reflects the metadata of @root rather than the external parent of the symlink target. This fix completely eliminates the discrepancy between lexical validation and physical path traversal within Rack::Directory.
Exploiting CVE-2026-142593 requires two prerequisites: the target Ruby application must mount or expose Rack::Directory on an HTTP endpoint, and the directory tree beneath @root must contain at least one directory symbolic link pointing to a location outside @root (or pointing deeper into a directory structure whose ancestor or sibling directories are not meant to be exposed). This layout is standard in Ruby deployments managed by tools such as Capistrano or Mina, where the document root (/var/app/current/public) contains symbolic links pointing into a persistent shared directory (/var/app/shared/system or /var/app/shared/public/uploads) situated alongside sensitive directories like /var/app/shared/config or /var/app/shared/log.
Consider the following directory structure on a server running a vulnerable version of Rack with Rack::Directory.new("/var/app/current"):
/var/app/
├── current/ <-- @root (Document Root)
│ ├── assets/
│ └── system -> /var/app/shared/system
└── shared/
├── system/
│ ├── a.txt
│ └── sub/
│ └── b.txt
└── config/
└── database.ymlTo enumerate the parent directory of the symlink target (/var/app/shared), an unauthenticated attacker sends an HTTP GET request appending /../ to the symlinked /system path. Note that standard HTTP clients (such as curl or web browsers) often normalize .. segments client-side before transmitting the request; therefore, an attacker must either pass --path-as-is in curl or URL-encode the dots as %2e%2e or %2E%2E so that the literal traversal sequence reaches Rack.
GET /system/%2E%2E/ HTTP/1.1
Host: vulnerable-rack-app.local
Accept: text/htmlWhen Rack receives GET /system/%2E%2E/, Utils.unescape_path decodes PATH_INFO to /system/../. check_forbidden verifies that File.expand_path("/system/../", "/var/app/current") equals "/var/app/current" and allows the request. Dir.foreach("/var/app/current/system/../") then follows the symlink to /var/app/shared/system and ascends one level to list /var/app/shared/, returning an HTML table revealing the existence of the config/ directory. The attacker can then pivot into sibling directories by requesting:
GET /system/%2E%2E/config/ HTTP/1.1
Host: vulnerable-rack-app.local
Accept: text/htmlThis second request resolves lexically to /var/app/current/config (passing check_forbidden), while resolving physically in the kernel to /var/app/shared/config/. The HTTP 200 response returns the directory listing of /var/app/shared/config/, exposing database.yml along with its exact byte size and last-modified timestamp. If the symlink target is nested multiple levels deep (e.g., /var/app/shared/storage/public/system), the attacker can chain multiple .. segments (GET /system/sub/%2E%2E/%2E%2E/config/) provided the number of .. segments does not exceed the number of preceding path segments in PATH_INFO.
CVE-2026-142593 is assigned a CVSS v3.1 base score of 5.3 (Medium) with the vector string CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:L/I:N/A:N. The vulnerability is remotely exploitable over the network (AV:N) with low attack complexity (AC:L), requires no privileges (PR:N) or user interaction (UI:N), and does not impact integrity (I:N) or availability (A:N).
The confidentiality impact is rated Low (C:L) because the information disclosure is strictly confined to directory listings and file metadata (stat attributes: file names, directory hierarchy, byte sizes, MIME types derived from file extensions, and mtime timestamps). An attacker cannot use this vulnerability to read the contents of files discovered outside @root (such as /var/app/shared/config/database.yml). When a request targets a file rather than a directory, Rack::Directory delegates the request to @app (Rack::Files), and Rack::Files independently sanitizes PATH_INFO using Rack::Utils.clean_path_info prior to reading from the filesystem.
Additionally, the depth of upward traversal from the symlink target is bounded by the depth of the symlink within PATH_INFO. Because check_forbidden enforces that the lexical expansion of PATH_INFO cannot ascend above @root, a path with $N$ leading directory components before or within the symlink can contain at most $N$ dot-dot (..) segments. For example, if a symlink resides at depth 1 (/system), an attacker can use at most one .. segment after /system to inspect the immediate parent and siblings of the symlink target, or descend into subdirectories of the symlink target (/system/sub1/sub2/../../../) to increase the lexical depth budget before traversing upward.
From a threat intelligence perspective, the Exploit Prediction Scoring System (EPSS) assigns CVE-2026-142593 a score of 0.00818 (0.82%), placing it at the 58.47th percentile. The vulnerability is not listed in the CISA Known Exploited Vulnerabilities (KEV) catalog, and no weaponized exploits are currently tracked in public exploit databases beyond the regression test suite included in the official Rack security commits.
To remediate CVE-2026-142593, upgrade the rack gem to the patched maintenance release corresponding to your application's version branch:
Update your Gemfile or gemspec constraints and run Bundler to install the fixed release:
bundle update rack> [!NOTE]
> Rack versions prior to 2.2.0 unconditionally rejected any PATH_INFO containing .. and are not vulnerable to CVE-2026-142593.
For environments where an immediate gem upgrade cannot be deployed, administrators can apply the following compensating controls:
Rack::Directory that normalizes env['PATH_INFO'] via Rack::Utils.clean_path_info (or rejects requests where Rack::Utils.unescape_path(env['PATH_INFO']).include?('..') with an HTTP 403 Forbidden response).Rack::Directory using find /path/to/root -type l -ls and remove or relocate symbolic links that point outside the served directory tree.Rack::Directory in production Ruby processes and handle directory indexing or static asset delivery at the reverse proxy layer (such as NGINX or Apache HTTP Server), where symlink traversal policies (disable_symlinks on; in NGINX) can be strictly enforced.CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:L/I:N/A:N| Product | Affected Versions | Fixed Version |
|---|---|---|
rack Rack | >= 2.2.0, < 2.2.26 | 2.2.26 |
rack Rack | >= 3.0.0, < 3.1.24 | 3.1.24 |
rack Rack | >= 3.2.0, < 3.2.9 | 3.2.9 |
| Attribute | Detail |
|---|---|
| Vulnerability Type | CWE-22 (Path Traversal) / CWE-59 (Improper Link Resolution) |
| Affected Component | Rack::Directory (lib/rack/directory.rb) |
| Attack Vector | Network (Unauthenticated HTTP GET with '..' following a symlink) |
| CVSS v3.1 Score | 5.3 Medium (CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:L/I:N/A:N) |
| EPSS Score | 0.82% (58.47th Percentile) |
| Security Impact | Unauthorized directory listing and file metadata disclosure outside document root |
| Exploit Status | Proof of Concept (Upstream regression test; not listed in CISA KEV) |
| Patched Versions | Rack 2.2.26, 3.1.24, 3.2.9 |
The software uses external input to construct a pathname that should be within a restricted directory, but it does not properly neutralize sequences such as '..' that can resolve to a location outside of that directory, particularly when combined with symbolic link resolution (CWE-59).
CVE-2026-142637 (GHSA-ch34-gjmh-c4hp) is a query logic injection vulnerability (CWE-943) in the Laravel framework prior to versions 12.73.0 and 13.43.0. When fluent database validation rules such as Rule::exists() or Rule::unique() are scoped using the scalar where() method, the framework serializes the rule object into its legacy comma-delimited string format and subsequently reparses it. During reparsing, the database presence verifier evaluates specific reserved tokens—'NULL', 'NOT_NULL', and values prefixed with '!'—as SQL predicates rather than literal values. If an application passes untrusted user input into a fluent where() scope, an attacker can supply these sentinel tokens to alter the SQL evaluation logic and bypass multi-tenant isolation or ownership validation.
CVE-2026-142622 (GHSA-ww2c-pqp9-rvrq) is an origin validation error (CWE-346) in the Laravel Framework (`laravel/framework`) prior to version 12.53.0. The Pusher and Reverb broadcasting drivers previously accepted a `callback` query parameter on the `/broadcasting/auth` endpoint, returning the channel authentication token wrapped in a JSONP response. Because this endpoint also accepted HTTP GET requests without CSRF validation, an external page could include the authorization endpoint via an HTML `<script>` tag to bypass Same-Origin Policy protections and exfiltrate the authenticated user's private or presence channel tokens.
A denial-of-service vulnerability exists in versions 0.19.0 and 0.19.1 of the Rust bcrypt crate (tracked as GHSA-xj2x-f8qw-37mr and RUSTSEC-2026-0199). When parsing a 60-byte hash string containing multi-byte UTF-8 sequences positioned across internal slice offsets, the split_hash function performs direct string slicing across non-character boundaries. This violation of Rust's UTF-8 string invariants triggers an unhandled thread panic (str::slice_error_fail), enabling attackers who can supply or modify hash strings to crash authentication worker threads or terminate processes configured to abort on panic.
CVE-2026-142591 (GHSA-f7cc-57h7-qrcg) is an uncontrolled resource consumption vulnerability in the Rack Ruby web server interface library. The flaw resides in Rack::QueryParser, which uses quantified regular expressions to split query strings, parse application/x-www-form-urlencoded request bodies, and evaluate nested parameter names. In Ruby's Onigmo regular expression engine, greedy quantifiers allocate approximately 48 bytes of native backtracking state per matched character. An unauthenticated remote attacker can transmit crafted payloads containing long runs of spaces or bracket characters within Rack's default 4 MiB byte-size limit to trigger an approximate 48x transient memory amplification, allocating up to 200 MB per request and exhausting process or container memory under concurrent load.
CVE-2026-142592 is an uncontrolled resource consumption vulnerability (CWE-400) in Rack, the modular Ruby web server interface. In affected versions within the 3.1.x and 3.2.x branches, the multipart form-data parser directly passes untrusted charset parameters to Ruby's internal Encoding.find method without pre-validation or caching. Because Ruby's MRI runtime traverses the entire $LOAD_PATH searching for shared libraries whenever an unknown encoding is requested, an unauthenticated attacker can submit a multipart payload with thousands of invalid charset parameters to trigger millions of filesystem lookup operations, exhausting CPU and I/O resources and causing denial of service.
A projection sanitization and schema path exclusion bypass vulnerability exists in Mongoose versions 8.5.0 through 8.24.9 and 9.0.0 through 9.12.1. Due to insufficient validation of MongoDB projection syntax in `sanitizeProjection` and `applyPaths`, attackers supplying untrusted projection inputs to queries can force the retrieval of sensitive schema fields configured with `select: false`, such as password hashes, reset tokens, and multi-factor authentication secrets.