GHSA-rmxm-3fg6-px4f: Medium severity npm/@hono/node-server vulnerability
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.
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
Event History
Frequently Asked Questions
Which applications are exposed to this issue?
Applications are exposed when they use serveStatic and mount middleware, such as authentication checks, on a prefix within the directory being served. Applications that serve only public static files are not affected.
What does an attacker need to exploit it?
An unauthenticated attacker can send a crafted request containing a malformed percent-encoded path. The request must target a setup where middleware protection depends on the static-path prefix.
Can this vulnerability be used to read files outside the configured static root?
No. The resolved file remains inside the configured root; the issue is a middleware-bypass condition rather than directory traversal outside that root.
What should be prioritized if patching cannot happen immediately?
Prioritize reviewing static directories that contain files intended to be protected by middleware mounted on a path prefix. Restrict access to those files or avoid relying on prefix-mounted middleware for their protection until the issue is remediated.