REDHAT-BUG-2555734: Medium severity npm/hono vulnerability
Hono is a Web application framework that provides support for any JavaScript runtime. From 4.12.4 until 4.13.11, serveStatic can interpret a malformed percent-encoded path differently from upstream routing middleware and bypass protection for a static prefix. The root cause is serveStatic decodes a routed request path a second time before filesystem lookup. The attack mechanism is malformed percent encoding survives the first routing interpretation and becomes a protected path only during the later static-file decode. The affected component is serveStatic. The trigger conditions are an application protects a static prefix with upstream middleware and serveStatic receives an attacker-controlled malformed percent-encoded path. The impact is unauthorized disclosure of a static file that upstream middleware was intended to protect. The issue does not permit traversal outside the configured static root. This issue is fixed in version 4.13.11.
Affected Software
Remediation
Recommended actions to resolve this vulnerability, in priority order.
- Upgrade
Upgrade to a fixed release to a version that resolves this vulnerability.
Fixed in 4.13.11
Event History
Frequently Asked Questions
Which applications are realistically exposed to this issue?
Applications using Hono's serveStatic component are exposed only when they rely on upstream routing middleware to protect a static URL prefix. Applications that do not serve static files through serveStatic, or do not apply such prefix-based protection, are not described as affected by this bypass.
What does an attacker need to exploit the vulnerability?
An attacker needs to send a malformed percent-encoded request path to serveStatic. Exploitation depends on that path being interpreted differently by the upstream routing middleware and by serveStatic's later filesystem-path decoding.
Can this vulnerability expose files outside the configured static directory?
No. The issue can disclose static files that middleware was intended to protect, but it does not permit directory traversal outside the configured static root.
What version fixes the issue?
The issue is fixed in Hono version 4.13.11. The affected range is from 4.12.4 until 4.13.11.