CVE-2026-118663: @hono/node-server: `serveStatic` decodes the request path a second time, leading to bypass of middleware on static paths
@hono/node-server allows running the Hono application on Node.js. From 1.19.10 until 2.1.3, serveStatic decodes a request path a second time after Hono has already decoded it for routing, so a malformed percent-encoded sequence can make route middleware evaluate an encoded path while static file resolution uses a different directory. An unauthenticated attacker can bypass middleware mounted on a protected static prefix and read a file inside the configured static root, although the flaw does not permit traversal outside that root. This issue is fixed in version 2.1.3.
Other sources
Summary
serveStatic decodes the request path a second time after Hono has already decoded it for routing. A crafted request can be routed as one path and served as another, so middleware mounted on a static prefix does not run for a file under that prefix.
Details
Hono decodes the request path once before routing. serveStatic decoded it again before resolving the file. With a malformed percent-encoded sequence, the first decode leaves part of the path encoded, the router matches the encoded form, and the second decode resolves the real directory. The file is still resolved inside the configured root; this is not a traversal outside it.
Impact
An unauthenticated attacker may reach static files without the middleware on their prefix running, for example an authentication check. This affects applications that mount middleware on part of the directory served by serveStatic. Applications that serve only public files are not affected.
— GitHub
Affected Software
Remediation
Recommended actions to resolve this vulnerability, in priority order.
- Upgrade
Upgrade
npm/@hono/node-serverto a version that resolves this vulnerability.Fixed in 2.1.3 - Upgrade
Upgrade
@hono/node-serverto a version that resolves this vulnerability.Fixed in 2.1.3
Event History
Frequently Asked Questions
Which deployments are exposed?
Deployments using @hono/node-server versions from 1.19.10 up to, but not including, 2.1.3 are affected when serveStatic is used and middleware protects a static-path prefix. The affected static files must be within the configured static root.
What does an attacker need to exploit this issue?
An attacker does not need authentication or user interaction. They need to send a crafted request containing a malformed percent-encoded path sequence that causes routing and static-file resolution to interpret the path differently.
What is the practical impact?
An attacker can bypass middleware mounted on a protected static prefix and read a file within the configured static root. The issue does not allow path traversal outside that root.
How should this be remediated?
Upgrade @hono/node-server to version 2.1.3, which fixes the issue.