/

CVE-2026-18427

Severity:

HIGH RISK

(7.5)

Path Traversal (CWE-22) in @fastify/static Route Handler

CVE-2026-18427

Received

Vulnerability type

Category:

Path Traversal

CWE:

CWE-22, CWE-436

Impact:

Unauthorized Sensitive File Disclosure

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

@fastify/static before version 10.1.3 can mishandle non-canonical URL paths when route-based guards protect files beneath a static root. An unauthenticated attacker may use alternate path representations to bypass the guarded route and disclose protected file contents when the application relies on route-based protection.

Affected context

The issue occurs in applications that use @fastify/static to serve files and apply authorization through route-based guards covering part of the static directory. It is relevant when pathname variations such as dot segments, repeated slashes, encoded dots, or backslashes are matched before consistent canonicalization. Applications that rely on the allowedPath option for access control are not affected in the same way.

Exploit preconditions

  • Attack surface: An HTTP-accessible static file route
  • Required access: No authentication may be required to send requests to the static handler
  • Protected resource: A sensitive file or subtree protected by a route-based guard
  • Trigger point: Request processing before routing and static-file delegation use the same canonical pathname
  • Why exploitation is possible: A non-canonical path can miss the guarded route while resolving to a protected file in the static serving layer

Why this happens

The underlying bug is inconsistent path normalization across routing and file serving. The handler rejected some parent-directory traversal patterns but did not canonicalize other equivalent pathname forms, including dot segments, duplicate separators, encoded dots, and backslashes, before route matching and delegation.

This maps primarily to CWE-22: Improper Limitation of a Pathname to a Restricted Directory, because alternate path representations can escape the intended authorization boundary. It also relates to CWE-436: Interpretation Conflict, where different components interpret the same input differently.

Potential impact

  • Protected file contents may be disclosed to unauthenticated users
  • Route-based authorization boundaries could be bypassed
  • Application secrets, configuration data, or internal assets may be exposed
  • Disclosed files could support follow-on attacks against the application or hosting environment

General mitigation guidance

Mitigation generally focuses on making authorization and file resolution operate on one consistently canonicalized pathname.

Common defensive patterns include:

  • Canonicalizing pathnames before route matching, authorization, and static-file resolution
  • Rejecting ambiguous separators, backslashes, encoded dot segments, and other non-canonical forms
  • Applying authorization after normalization and before file access
  • Prefering dedicated allow-list path checks such as an allowedPath-style control for protected content
  • Keeping sensitive files outside publicly served static roots
  • Running the application with least-privilege filesystem permissions
  • Using a vendor-supported release containing the complete path-canonicalization fix

How teams detect issues like this

Organizations can look for this class of issue through:

  • Static analysis and code review checks for route authorization that differs from filesystem path resolution
  • Tests covering dot segments, repeated slashes, encoded separators or dots, and backslashes
  • Request logging and alerting for unusual path normalization patterns targeting protected resources
  • Policy checks requiring canonicalization before authorization and file-serving operations
  • Integration tests that verify every equivalent pathname representation receives the same authorization decision

Automated security review tools may help identify inconsistent path handling, but behavioral tests are important because the issue depends on interactions between routing and file resolution.

Sources

SourceLink
cna.openjsf.orgcna.openjsf.org/security-advisories.html
github.comgithub.com/fastify/fastify-static/security/advisories/GHSA-423g-23ch-w7c6

Frequently asked

questions

Yes, when the affected static handler is reachable over HTTP and a protected subtree relies on route-based authorization. The attacker generally needs only the ability to send requests.

Not necessarily. The described impact applies to unauthenticated requests when the static route is publicly reachable and the route guard can be bypassed through a non-canonical path.

Canonicalize and validate the pathname before both route authorization and static-file resolution, reject ambiguous path forms, and use an explicit allow-list path control for protected content.

Keep sensitive files outside public static roots where practical, test equivalent path representations, enforce consistent normalization across layers, and apply least-privilege filesystem permissions.

Find out what's already
exploitable in your codebase.