MediumGHSA-mhj6-xc86-54m8CVE-2026-142593

Rack: `Rack::Directory` lists directories outside the root when `..` follows a symbolic link

Published 3 Dec 2026 · Updated 4 Dec 2026

Affected packages

rackRubyGems
Affected
>=2.2.0 <2.2.26
Fixed in
2.2.26
Update to the fixed version for your release line, for example:bundle update --conservative rack # Gemfile: '>= 2.2.26'
rackRubyGems
Affected
>=3.0.0 <3.1.24
Fixed in
3.1.24
Update to the fixed version for your release line, for example:bundle update --conservative rack # Gemfile: '>= 3.1.24'
rackRubyGems
Affected
>=3.2.0 <3.2.9
Fixed in
3.2.9
Update to the fixed version for your release line, for example:bundle update --conservative rack # Gemfile: '>= 3.2.9'

We confirm your address first. See our privacy policy.

Which rack does your project really install?

Drop your Gemfile.lock hereWe find the exact rack version you install, even when another package pulls it in, and tell you if it’s affected and what to run. Free, no sign-up.

Works for private projects: the file is read in memory to run the scan and then dropped. Also reads Gemfile.

Public repo?

Look after several Rails or Ruby apps? Indie watches up to 15 repos, private ones too, for $5 a month. See Indie

Details

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:

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.

Is GHSA-mhj6-xc86-54m8 in any of your client repos?

Checking one package by hand is fine. Checking it across forty client projects is not. NPMscan reads the lockfiles in every GitHub repo you pick, finds each project with an affected rack, and gives you the command that fixes it.

More advisories for rack

  • HighCVE-2026-142592Rack: Multipart parser searches the load path for every unknown part `charset`, allowing denial of service via CPU exhaustion · 3 Dec 2026
  • MediumCVE-2026-142591Rack: `Rack::QueryParser` separator pattern allocates ~48 bytes per space after `&`, allowing denial of service via memory amplification · 3 Dec 2026
  • LowCVE-2026-142594Rack: `Rack::Multipart` extracts the boundary by substring match rather than parameter parsing, allowing parser differentials and WAF bypass · 3 Dec 2026
  • MediumCVE-2026-142590Rack: `Rack::Multipart::Parser` preserves CRLF from multipart part headers in parsed parameter names (incomplete fix for CVE-2026-26962) · 2 Dec 2026
  • HighCVE-2026-125111Rack: Multipart parsing allows DoS via unbounded scan buffer growth · 10 Nov 2026
  • LowCVE-2026-125108Rack: Multipart boundary ambiguity guard in Rack::Multipart::Parser can be bypassed with a quoted boundary value, allowing WAF bypass · 10 Nov 2026
All 59 advisories for rack

References

Advisory data from OSV.dev (opens OSV.dev in a new tab), refreshed daily.