CVE-2026-142593: Rack `Rack::Directory` Lists Directories Outside The Vulnerability
MODERATECVE-2026-142593 is a MODERATE (CVSS 5.3) `rack::directory` lists directories outside the vulnerability (CWE-59: Improper Link Resolution Before File Access ('Link Following')) affecting Rack libraries in the RubyGems ecosystem. The issue involves `rack::directory` lists directories outside the root when `..` follows a symbolic link. Remediation is available by upgrading affected packages to version 2.2.26, 3.1.24, 3.2.9.
CVE-2026-142593 at a Glance
Security Impact
CVSS: 5.3
The security impact metrics below are parsed directly from the CVSS v3.1 vector string (CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:L/I:N/A:N).
How to Fix CVE-2026-142593
To remediate this vulnerability, upgrade all affected Rack dependencies to a patched release. Both direct and transitive dependencies should be checked, as frameworks or security libraries may pull in vulnerable versions transitively.
Upgrade rack to 2.2.26
Upgrade rack to 3.1.24
Upgrade rack to 3.2.9
Run the following command in your project directory to verify that all resolved dependencies use the patched release:
inspect dependencies for rack
How to Check if You Are Affected
To determine whether your application is affected by CVE-2026-142593, inspect your project dependencies for Rack:
inspect dependencies for rack
Analyze the terminal output to locate any version of Rack in your dependency tree. If any resolved version matches the vulnerable ranges listed in the table below (for example, versions earlier than 2.2.26), your application is affected.
Note: Verify declared build manifests and deployed runtime container environments.
Technical Details
Vulnerability Mechanism & Technical Analysis
This vulnerability is classified under CWE-59: Improper Link Resolution Before File Access ('Link Following'), where the product attempts to access a file based on the filename, but it does not properly prevent that filename from identifying a link or shortcut that resolves to an unintended resource. In Rack, software state validation or input boundaries are circumvented during processing. Review the official source advisory statement below for specific affected components, classes, and reproduction details.
Source Advisory Statement
CVE-2026-142593 Affected Rack Versions
3 component(s)References
Frequently Asked Questions
What is CVE-2026-142593?
Which Rack versions are affected?
What version fixes CVE-2026-142593?
Is rack affected?
What is the CVSS score of CVE-2026-142593?
What CWE is associated with CVE-2026-142593?
How can I check RubyGems dependencies for CVE-2026-142593?
Machine-readable OSV JSON
OSV v1.5 Schema
{
"schema_version" : "1.4.0",
"id" : "GHSA-mhj6-xc86-54m8",
"modified" : "2026-12-03T23:44:42Z",
"published" : "2026-12-03T23:44:42Z",
"aliases" : [ "CVE-2026-142593" ],
"summary" : "Rack: `Rack::Directory` lists directories outside the root when `..` follows a symbolic link",
"details" : "## Summary\n\n`Rack::Directory#get` decides whether a request path containing `..` stays inside the root by expanding it lexically with `File.expand_path`, but then joins the original, unnormalized path onto the root and passes it to `File.stat` and `Dir.foreach`. The operating system resolves a symbolic link before applying a `..` that follows it, so when a directory under the root is a symlink, a request such as `/system/../` passes the check while the filesystem lists the parent of the link's target, and `/system/../config/` lists a sibling of the target. Both are outside the root. This results in disclosure of file and directory names, sizes and modification times outside the served tree.\n\n## Details\n\nThe check and the filesystem access use different paths:\n\n```ruby\ndef get(env)\n path_info = Utils.unescape_path(env[PATH_INFO])\n if client_error_response = check_bad_request(path_info) || check_forbidden(path_info)\n client_error_response\n else\n path = ::File.join(@root, path_info) # unnormalized\n list_path(env, path, path_info, script_name) # File.stat, Dir.foreach\n end\nend\n\ndef check_forbidden(path_info)\n return unless path_info.include? \"..\"\n expanded_path = ::File.expand_path(::File.join(@root, path_info)) # lexical\n return if expanded_path == @root || expanded_path.start_with?(@root_with_separator)\n # 403\nend\n```\n\nWith `public/system` linked to `shared/system`, `File.expand_path(\"public/system/../\")` is `public`, so the request is allowed, but `Dir.foreach(\"public/system/../\")` is evaluated by the kernel as `shared/system/..`, which is `shared`. The climb is bounded to one level above each symlink target, but any further symlink discovered in a listing can be used to climb again. Percent-encoded forms such as `%2E%2E` behave the same way. The `Rack::Files` application that `Rack::Directory` delegates to for files normalizes the path with `Utils.clean_path_info` before touching the filesystem, so file contents outside the root are not readable through this path; only directory listings leak.\n\n`Rack::Directory` documents that it follows symbolic links, meaning that the link's target is served. This issue goes further: the target's parent and siblings become browsable.\n\nAll supported versions since 2.2.0 are affected. Earlier versions rejected every path containing `..`.\n\n## Impact\n\nApplications that mount `Rack::Directory`, directly or through `rackup` with a directory application, with any symbolic link to a directory under the root. The Capistrano convention of linking `public/system`, `public/uploads` or `public/assets` into a release-independent `shared/` directory is the common case, and `shared/` typically also holds `config/database.yml`, `config/master.key`, logs and PID files. An unauthenticated attacker obtains the names, sizes and modification times of those entries, and can walk further through any other symlinks found. No authentication, malformed HTTP, or large payload is required. File contents are not disclosed.\n\n## Mitigation\n\n* Update to a patched version of Rack, in which `Rack::Directory` normalizes the request path with `Utils.clean_path_info` before accessing the filesystem, as `Rack::Files` already does.\n* Avoid symbolic links to directories under a root served by `Rack::Directory`, or avoid exposing `Rack::Directory` to untrusted clients.\n* At a reverse proxy, reject request paths containing `..` or `%2E%2E` segments.",
"severity" : [ {
"type" : "CVSS_V3",
"score" : "CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:L/I:N/A:N"
} ],
"affected" : [ {
"package" : {
"ecosystem" : "RubyGems",
"name" : "rack"
},
"ranges" : [ {
"type" : "ECOSYSTEM",
"events" : [ {
"introduced" : "2.2.0"
}, {
"fixed" : "2.2.26"
} ]
} ]
}, {
"package" : {
"ecosystem" : "RubyGems",
"name" : "rack"
},
"ranges" : [ {
"type" : "ECOSYSTEM",
"events" : [ {
"introduced" : "3.0.0"
}, {
"fixed" : "3.1.24"
} ]
} ]
}, {
"package" : {
"ecosystem" : "RubyGems",
"name" : "rack"
},
"ranges" : [ {
"type" : "ECOSYSTEM",
"events" : [ {
"introduced" : "3.2.0"
}, {
"fixed" : "3.2.9"
} ]
} ]
} ],
"references" : [ {
"type" : "WEB",
"url" : "https://github.com/rack/rack/security/advisories/GHSA-mhj6-xc86-54m8"
}, {
"type" : "ADVISORY",
"url" : "https://nvd.nist.gov/vuln/detail/CVE-2026-142593"
}, {
"type" : "WEB",
"url" : "https://github.com/rack/rack/commit/42af7a7b10c54021e060e52c91a590a5d5f2a48d"
}, {
"type" : "WEB",
"url" : "https://github.com/rack/rack/commit/c7102e91e4a1ee832b006790de31b3d5b207b89e"
}, {
"type" : "WEB",
"url" : "https://github.com/rack/rack/commit/d73bdad9e2ebec7217ecd3e9bbc079f076b0d120"
}, {
"type" : "PACKAGE",
"url" : "https://github.com/rack/rack"
}, {
"type" : "WEB",
"url" : "https://github.com/rack/rack/releases/tag/v2.2.26"
}, {
"type" : "WEB",
"url" : "https://github.com/rack/rack/releases/tag/v3.1.24"
}, {
"type" : "WEB",
"url" : "https://github.com/rack/rack/releases/tag/v3.2.9"
} ],
"database_specific" : {
"cwe_ids" : [ "CWE-22", "CWE-59" ],
"severity" : "MODERATE",
"github_reviewed" : true,
"github_reviewed_at" : "2026-12-03T23:44:42Z",
"nvd_published_at" : "2026-12-02T22:18:36Z"
}
}