/

CVE-2026-41493

Severity:

HIGH RISK

(7.5)

Path Traversal in YARD Documentation Server

CVE-2026-41493

Analyzed

Vulnerability type

Category:

Path Traversal

CWE:

CWE-22

Impact:

Arbitrary File Read on Server Host

Severity:

HIGH RISK

(7.5)

CVSS version:

3.1

Catch this CVE while code is being written

Detect vulnerable code directly in pull requests, so CVEs are fixed before merge.

Summary

A path traversal vulnerability in the YARD documentation server allows crafted HTTP requests to access arbitrary files on the host filesystem.

Under certain deployment conditions, an attacker who can reach a running yard server instance may read sensitive files outside the intended documentation directory.

Affected context

This vulnerability affects environments where yard server is used to serve generated Ruby documentation over HTTP.

Risk is elevated when:

  • The YARD server is accessible from untrusted networks (e.g., internet-facing or shared development networks)
  • The process has read access to sensitive files on the host
  • Requests are not filtered or proxied by a layer that enforces stricter path constraints

In such setups, insufficient path normalization in request handling can expose files outside the intended documentation root.

Exploit preconditions

  • Attack surface: HTTP interface of a running yard server instance
  • Required access: Network access to the YARD server endpoint (no direct shell or local account required)
  • Trigger point: Sending specially crafted HTTP requests containing manipulated path components
  • Why exploitation is possible: The server's request routing logic fails to properly normalize and validate user-supplied paths, allowing traversal sequences (e.g., parent-directory references) to escape the documentation root and reach other readable files.

Why this happens

The root cause aligns with CWE-22: Improper Limitation of a Pathname to a Restricted Directory ('Path Traversal').

The YARD server trusted user-controlled URL path segments to locate files on disk without robust canonicalization and enforcement that the resolved path stayed within a designated documentation directory.

This insecure pattern arises when:

  • Path components from HTTP requests are concatenated or mapped directly to filesystem paths
  • Validation focuses on superficial checks (such as simple string filters) rather than canonical path resolution and strict root checks

As a result, an attacker can influence the final resolved path to target arbitrary files that the YARD process can read.

Potential impact

  • Reading configuration files containing secrets or credentials that the YARD process can access
  • Exposure of application source code, comments, and internal documentation stored on the same host
  • Leakage of environment-specific data such as logs, temporary files, or deployment metadata
  • Gathering information that can facilitate further attacks, such as privilege escalation or lateral movement in the environment

General mitigation guidance

Effective mitigation focuses on constraining filesystem access and hardening path handling:

  • Enforce strict directory whitelisting: resolve requested paths to their canonical form and verify they remain within a defined documentation root before serving any content.
  • Avoid direct concatenation of user-controlled paths with filesystem locations; instead, use routing layers or mapping tables that only expose known, allowed resources.
  • Run the YARD server with least-privilege file permissions, ensuring it can only read documentation assets and not sensitive system or application files.
  • Place YARD behind a hardened reverse proxy that restricts unusual path patterns, blocks traversal sequences, and limits exposed URL surfaces.
  • Prefer secure defaults in tooling and configuration, favoring read-only views of pre-generated documentation over dynamic file serving where possible.

How teams detect issues like this

Detection generally involves both code-level and operational checks:

  • Static analysis: Search for filesystem operations that incorporate HTTP path parameters without canonicalization and root-directory enforcement; flag usage where .. or raw path segments are accepted unchecked.
  • Code review: Inspect routing logic and file-serving handlers in the YARD server integration for:
  • Direct use of URL paths to build filesystem paths
  • Lack of checks to ensure resolved paths remain under a specific documentation directory
  • Runtime monitoring: Analyze HTTP access logs for suspicious patterns, such as repeated requests containing ../, encoded traversal sequences, or attempts to access known sensitive file names.
  • Security testing: Use automated scanners and manual tests to probe for directory traversal in endpoints that serve static files or documentation content.

Automated code review and SAST tools that support Ruby and common path traversal patterns can help highlight these issues early in development.

Sources

SourceLink
github.comgithub.com/lsegal/yard/releases/tag/v0.9.42
github.comgithub.com/lsegal/yard/security/advisories/GHSA-3jfp-46x4-xgfj

Frequently asked

questions

Yes, if the YARD server is reachable over the network from an attacker-controlled location. The attack is performed purely via HTTP requests; no local shell access is required.

The attacker needs network access to the running yard server instance. Exploitability and impact depend on what files the YARD process can read and whether the server is exposed beyond a trusted development environment.

The safest pattern is to strictly enforce that any file served is within a predefined documentation directory. Implement canonical path resolution, confirm that resolved paths remain inside this root, and reject any requests that attempt to traverse outside it. Additionally, restrict the YARD server's filesystem permissions to a minimal set of documentation files.

Adopt defensive patterns for any file-serving endpoint: never trust user-supplied paths directly, always enforce directory whitelisting, and use established framework utilities for static content routing. Combine this with least-privilege service accounts, configuration reviews for developer tools exposed over the network, and automated checks for path traversal patterns in code and infrastructure.

Find out what's already
exploitable in your codebase.