- Severity: MEDIUM
- CVE: CVE-2026-142593
- Ecosystems: rubygems, rubygems, rubygems
- Packages: rack, rack, rack
## 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/.…
Source: GitHub Security Advisories · 2026-12-03