CVE-2026-49342: YARD static cache reads raw traversal paths before router sanitization

Published Jun 19, 2026
·
Updated

Summary YARD's static cache lookup reads a request path before the router's path cleanup runs. When a server is configured with a document root, a traversal path such as /../yard-cache-secret.html is joined against that root and can return a readable sibling .html file outside the intended static tree.

The potential security risk seems low, as only html-ending files can be read, but still the risk of reading arbitrary html files is a confiendtiality issue in itself, which is why we decided to report. Please let us know if this is out of your project's scope.

Details The --docroot CLI option stores the configured directory in serveroptions[:DocumentRoot] at lib/yard/cli/server.rb:198, and adapter initialization copies that value into adapter.documentroot at lib/yard/server/adapter.rb:76. For Rack requests, RackAdapter#call builds a request object from the Rack environment at lib/yard/server/rackadapter.rb:58 and passes it to router.call(request) at lib/yard/server/rackadapter.rb:60. Router#call then stores the incoming request at lib/yard/server/router.rb:55 and invokes checkstaticcache before normal routing at lib/yard/server/router.rb:56. Inside checkstaticcache, the only initial guard is that adapter.documentroot is present at lib/yard/server/staticcaching.rb:35; the cache path is built from File.join(adapter.documentroot, request.path.sub(/\.html$/, '') + '.html') at lib/yard/server/staticcaching.rb:36, without cleaning .. components first. If that resolved path is a regular file, File.file? accepts it at lib/yard/server/staticcaching.rb:38 and the file bytes are returned as a 200 HTML response at lib/yard/server/staticcaching.rb:40. The later route sanitizer in finaloptions uses File.cleanpath(...).gsub(...) at lib/yard/server/router.rb:181 and lib/yard/server/router.rb:182, but a static-cache hit returns before that code is reached.

PoC poc.zip

bash bash ./poc/run.sh expected output: text run 1: exit=0 timedout=False duration=0.08s matched=True phase=oracle fingerprint='YARDSTATICCACHEPATHTRAVERSAL' run 2: exit=0 timedout=False duration=0.08s matched=True phase=oracle fingerprint='YARDSTATICCACHEPATHTRAVERSAL' run 3: exit=0 timedout=False duration=0.08s matched=True phase=oracle fingerprint='YARDSTATICCACHEPATHTRAVERSAL'

The YARDSTATICCACHEPATHTRAVERSAL fingerprint is emitted only after the PoC observes a 200 static-cache response whose body contains the sibling file outside the configured document root. A setup failure, syntax failure, or cache miss would not print this oracle and would not demonstrate this traversal read.

Impact A remote unauthenticated HTTP client who can reach a YARD documentation server with DocumentRoot/--docroot enabled can request .html paths containing parent-directory components and receive readable matching files outside the configured document root. The required guards are narrow: adapter.documentroot must be set, the traversed target must exist as a regular readable file, and the target must be reachable through the implementation's forced .html suffix. Those requests bypass the later finaloptions path cleanup because the cache check runs first. The resulting severity class is information disclosure: response bodies can contain off-root .html file contents, but this path does not show write access, code execution, or arbitrary files without the .html constraint.

Other sources

YARD is a documentation generation tool for the Ruby programming language. Prior to version 0.9.44, YARD's static cache lookup reads a request path before the router's path cleanup runs. When a server is configured with a document root, a traversal path such as /../yard-cache-secret.html is joined against that root and can return a readable sibling .html file outside the intended static tree. Version 0.9.44 patches the issue.

MITRE

Affected Software

2 affected componentsFixes available
rubygems/yard<0.9.44
rubygems/yard<0.9.44
0.9.44

Remediation

Recommended actions to resolve this vulnerability, in priority order.

  1. Upgrade

    Upgrade rubygems/yard to a version that resolves this vulnerability.

    Fixed in 0.9.44
  2. Upgrade

    Upgrade YARD to a version that resolves this vulnerability.

    Fixed in 0.9.44

Event History

Jun 19, 2026
CVE Published
via MITRE·07:13 PM
Data Sourced
via MITRE·07:13 PM
DescriptionSeverityWeakness
Data Sourced
via NVD·08:16 PM
DescriptionSeverityWeakness
Jun 26, 2026
Advisory Published
via GitHub·10:29 PM
Data Sourced
via GitHub·10:29 PM
DescriptionSeverityWeaknessAffected Software

Frequently Asked Questions

1

What is the severity of CVE-2026-49342?

CVE-2026-49342 has a medium severity rating of 5.3.

2

What type of vulnerability is CVE-2026-49342?

CVE-2026-49342 is a Path Traversal vulnerability.

3

How do I fix CVE-2026-49342?

To fix CVE-2026-49342, ensure that the router's path sanitization is properly applied before reading static cache.

4

What software is affected by CVE-2026-49342?

CVE-2026-49342 affects the YARD static documentation generation software.

5

What impact does CVE-2026-49342 have on my system?

CVE-2026-49342 can allow an attacker to access sensitive files outside the intended document root due to improper path handling.

Contact

SecAlerts Pty Ltd.
132 Wickham Terrace
Fortitude Valley,
QLD 4006, Australia
info@secalerts.co
By using SecAlerts services, you agree to our services end-user license agreement. This website is safeguarded by reCAPTCHA and governed by the Google Privacy Policy and Terms of Service. All names, logos, and brands of products are owned by their respective owners, and any usage of these names, logos, and brands for identification purposes only does not imply endorsement. If you possess any content that requires removal, please get in touch with us.
© 2026 SecAlerts Pty Ltd.
ABN: 70 645 966 203, ACN: 645 966 203