/

CVE-2026-15074

Severity:

HIGH RISK

(7.5)

Path Traversal Guard Bypass (CWE-22) in Fastify Static

CVE-2026-15074

Analyzed

Vulnerability type

Category:

Path Traversal

CWE:

CWE-22

Impact:

Unauthorized File Access within Static Root

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 guard bypass in @fastify/static up to 10.1.0 allows crafted dot-dot segments in request paths to slip past route-level protections.

An unauthenticated attacker can use this to reach files under the configured static root that should be shielded by route-scoped middleware, though they cannot escape the static root itself.

Affected context

This vulnerability appears in Node.js applications using @fastify/static (through 10.1.0) to serve files from a static root, particularly when route-scoped middleware or guards are applied to specific URL prefixes.

It arises when the application relies on URL path checks or middleware ordering to restrict which static files are reachable, while still allowing relative path segments in incoming requests.

Environments that depend on middleware-based filtering for sensitive or semi-private assets underneath the static root are the most exposed.

Exploit preconditions

  • Attack surface: HTTP(S) endpoints served via @fastify/static.
  • Required access: No authentication is required; any remote client able to issue HTTP requests to the affected routes can attempt exploitation.
  • Trigger point: Requests that include dot-dot path segments (e.g., ..) in the pathname targeting URLs guarded by route-scoped middleware or filters.
  • Why exploitation is possible: The Fastify layer fails to reject .. segments before delegating to the underlying send library.

The send library normalizes dot segments prior to enforcing its own path traversal protection, allowing the request to bypass middleware checks tied to specific URL prefixes while remaining inside the static root.

Why this happens

The underlying bug class is improper restriction of path traversal (CWE-22), specifically in the ordering and layering of path normalization and validation.

@fastify/static performed routing and guard decisions based on a raw or partially processed URL path that could still contain dot-dot segments, while the lower-level send library later normalized those segments and enforced its own traversal guard.

Because the framework did not canonicalize and validate the effective path before applying route-scoped protections, an attacker could craft paths that appear to fall under a guarded prefix but are later resolved to different files inside the static root, effectively bypassing middleware checks.

Potential impact

  • Unauthenticated clients may read files under the static root that were intended to be shielded by route-scoped middleware.
  • Attackers could access configuration or metadata files placed under guarded URL prefixes inside the static root.
  • Sensitive static assets (such as internal documentation, hidden admin resources, or pre-built bundles) could be exposed if they rely solely on route-prefix guards.
  • Information disclosure within the application's static directory structure may aid further attacks.

General mitigation guidance

Effective mitigation centers on enforcing canonical path validation before applying any routing or authorization logic.

Common defensive patterns include:

  • Normalizing and resolving request paths to a canonical form before checking prefixes, applying middleware decisions, or passing them to lower-level file-serving libraries.
  • Treating relative path indicators (such as .. and .) as invalid in externally supplied request paths and rejecting such requests early.
  • Avoiding reliance on route-scoped middleware alone to protect sensitive content within a shared static root; instead, segregate sensitive assets into separate roots or serve them via authenticated handlers.
  • Designing static-serving configurations to default to least privilege, only exposing explicitly intended paths and disallowing ambiguous or derived path mappings.

How teams detect issues like this

Detection can leverage both static and dynamic approaches:

  • Static analysis: Search for use of @fastify/static combined with route-scoped middleware that assumes path-prefix checks are sufficient protection for sensitive assets.
  • Code review: Flag patterns where static content is gated only by middleware applied to URL prefixes, without explicit checks on resolved filesystem paths.
  • Configuration review: Inspect static root layouts to identify sensitive files co-located with public assets and protected solely via routing configuration.
  • Dynamic testing: Use security testing or fuzzing tools to send requests with dot-dot segments and verify whether guarded assets become accessible.

Automated review tools and CI checks can be configured to highlight high-risk static-serving configurations and route-guard patterns.

Sources

SourceLink
cna.openjsf.orgcna.openjsf.org/security-advisories.html
github.comgithub.com/fastify/fastify-static/security/advisories/GHSA-83w8-p2f5-377r

Frequently asked

questions

Yes. Any remote client that can send HTTP requests to endpoints served by @fastify/static may exploit this issue, without needing authentication, as long as route-scoped guards are in place to be bypassed.

The attacker can only access files within the configured static root, but specifically those placed under URL prefixes that are supposed to be protected by middleware.

It does not by itself permit reading files outside the static root or arbitrary file system access.

Ensure that all request paths are canonicalized and validated before applying authorization or middleware-based decisions.

Reject any request containing dot-dot segments or other ambiguous path elements, and separate sensitive static content into dedicated, explicitly protected handlers rather than relying solely on route-prefix guards.

Design file-serving logic so that path normalization and validation happen as a first step, enforce strict disallowance of relative path components from user-controlled input, and avoid placing sensitive assets under general-purpose static roots.

Incorporate security reviews and automated tests that explicitly cover path traversal and guard-bypass scenarios whenever adding or modifying static-serving routes.

Find out what's already
exploitable in your codebase.