CVE-2026-142593: Rack `Rack::Directory` Lists Directories Outside The Vulnerability

MODERATE
Advisory Identifier: GHSA-mhj6-xc86-54m8
CVSS 5.3
CWE-59 CWE-22
Published
Advisory Summary

CVE-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

CVE Identifier CVE-2026-142593
GHSA Identifier GHSA-mhj6-xc86-54m8
Severity MODERATE
CVSS v3.1 Base Score 5.3
CWE Classification CWE-59: Improper Link Resolution Before File Access ('Link Following')
Affected Product Rack
Package Ecosystem RubyGems
Published Date
Last Updated

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).

Attack Vector Network (AV:N)
Attack Complexity Low (AC:L)
Privileges Required None (PR:N)
User Interaction None (UI:N)
Scope Unchanged (S:U)
Confidentiality Low (C:L)
Integrity None (I:N)
Availability None (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.

rack fixed: 2.2.26
Upgrade rack to 2.2.26
rack fixed: 3.1.24
Upgrade rack to 3.1.24
rack fixed: 3.2.9
Upgrade rack to 3.2.9
Verify Direct and Transitive Dependencies

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

## Summary `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. ## Details The check and the filesystem access use different paths: ```ruby def get(env) 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 path = ::File.join(@root, path_info) # unnormalized list_path(env, path, path_info, script_name) # File.stat, Dir.foreach end end def check_forbidden(path_info) return unless path_info.include? ".." expanded_path = ::File.expand_path(::File.join(@root, path_info)) # lexical return if expanded_path == @root || expanded_path.start_with?(@root_with_separator) # 403 end ``` With `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. `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. All supported versions since 2.2.0 are affected. Earlier versions rejected every path containing `..`. ## Impact Applications 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. ## Mitigation * 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. * Avoid symbolic links to directories under a root served by `Rack::Directory`, or avoid exposing `Rack::Directory` to untrusted clients. * At a reverse proxy, reject request paths containing `..` or `%2E%2E` segments.

CVE-2026-142593 Affected Rack Versions

3 component(s)
Fixed Versions:
2.2.263.1.243.2.9
Product / Package Ecosystem Affected Versions Fixed Version
rack
RubyGems
≥ 2.2.0
< 2.2.26
2.2.26
rack
RubyGems
≥ 3.0.0
< 3.1.24
3.1.24
rack
RubyGems
≥ 3.2.0
< 3.2.9
3.2.9

References

Frequently Asked Questions

What is CVE-2026-142593?
CVE-2026-142593 is a security vulnerability in Rack involving `Rack::Directory` lists directories outside the root when `..` follows a symbolic link under CWE-59: Improper Link Resolution Before File Access ('Link Following').
Which Rack versions are affected?
Affected versions include releases prior to 2.2.26, 3.1.24, 3.2.9 across affected packages: rack.
What version fixes CVE-2026-142593?
Upgrading to 2.2.26, 3.1.24, 3.2.9 (or the latest patched release for your respective branch) resolves the vulnerability.
Is rack affected?
Yes, rack is affected in releases prior to 2.2.26, 3.1.24, 3.2.9. Upgrade your dependency to 2.2.26, 3.1.24, 3.2.9 or later.
What is the CVSS score of CVE-2026-142593?
CVE-2026-142593 has a CVSS v3.1 base score of 5.3 (MODERATE) with vector string CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:L/I:N/A:N.
What CWE is associated with CVE-2026-142593?
CVE-2026-142593 is classified under CWE-59: Improper Link Resolution Before File Access ('Link Following') (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.).
How can I check RubyGems dependencies for CVE-2026-142593?
Run the dependency tree command: 'inspect dependencies for rack'. This command lists direct and transitive dependencies in your build configuration so you can verify if a vulnerable version is resolved.
Machine-readable OSV JSON OSV v1.5 Schema
Normalized schema output
{
  "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"
  }
}