Fastify/static Vulnerable to Route Guard Bypass via Path Traversal
The @fastify/static package is vulnerable to a route guard bypass via path traversal using non-leading '..' or '%2E%2E' path segments, allowing attackers to circumvent route-based middleware and access protected files that are served by the static plugin.
The @fastify/static package, specifically versions up to 10.1.0, is susceptible to a route guard bypass vulnerability, tracked as CVE-2026-15074. This vulnerability enables attackers to bypass route-based middleware and access protected files served by the static plugin. The core issue lies in how the find-my-way router processes path segments, failing to normalize .. or %2E%2E before matching routes. A previous fix for GHSA-x428-ghpx-8j92 only addressed %2F variants, leaving these other path traversal sequences unhandled. Consequently, these sequences survive decodeURI and encodeURI operations, only to be collapsed later by @fastify/send's path.normalize function, thereby circumventing initial security guards. This allows unauthorized access to sensitive files or directories intended to be protected by application-level routing.
Attack Chain
- An attacker crafts an HTTP GET request targeting a
fastify/staticendpoint that serves files. The request path includes a crafted sequence like/foo/../deep/secret.txtor/foo/%2E%2E/deep/secret.txt. - The request reaches the
find-my-wayrouter which is used by Fastify. Due to its inability to normalize..or%2E%2Esegments before route matching, the crafted path bypasses specific, guarded routes (e.g.,/deep/*). - The request instead matches the static plugin's broader catch-all route, allowing the request to proceed despite the intended route guard.
- The
getPathnameForSendhelper, intended to prevent path traversal, processes the URI. However, it only adequately guards against%2Fvariants, allowing..and%2E%2Esegments to remain in the path afterdecodeURIandencodeURIround-trips. - The request is then passed to
@fastify/send, which internally usespath.normalize. This function collapses the..or%2E%2Esegments, effectively resolving the path todeep/secret.txt. - The
fastify/staticplugin, now operating under the collapsed and normalized path, serves thesecret.txtfile from the/deep/directory, which was intended to be protected by route-based middleware. - The attacker successfully gains unauthorized access to the protected
secret.txtfile, circumventing the application's security controls.
Impact
The successful exploitation of CVE-2026-15074 leads to unauthorized access to files or directories that are otherwise protected by an application's route-based middleware or guards. This can result in sensitive information disclosure, including configuration files, source code, or proprietary data, which could further enable attackers to escalate privileges, gain persistence, or exfiltrate critical business assets. Any application relying on @fastify/static for serving static content with route-based access controls is at risk, potentially exposing a wide range of assets.
Recommendation
- Upgrade
@fastify/staticto version 10.1.1 or higher immediately to patch CVE-2026-15074. - If immediate upgrade is not feasible, implement the workaround: avoid relying on route-based middleware or guards to protect files served by
@fastify/static. - Deploy the Sigma rule provided in this brief to your SIEM to detect attempts at exploiting this path traversal vulnerability.
Detection coverage 1
Detects CVE-2026-15074 Exploitation - Fastify/static Path Traversal Bypass
highDetects CVE-2026-15074 exploitation - attempts to bypass fastify/static route guards using non-leading path traversal sequences in HTTP requests, such as '../' or '%2E%2E/'.
Detection queries are available on the platform. Get full rules →