Skip to content

GHSA-q5qw-h33p-qvwr CVE-2026-29045

Hono vulnerable to arbitrary file access via serveStatic vulnerability

Critical npm
Severity
7.5 / 10
Critical · CVSS 3.1
Exploit chance (EPSS)
0.59%
Chance of exploitation in the next 30 days. Higher than 48.10% of scored vulnerabilities.
Known exploited
No
Not in CISA's catalog
Weakness
CWE-177 Improper Handling of URL Encoding (Hex Encoding)
Fix
4.12.4
Upgrade hono to this version or later

Description

Summary

When using serveStatic together with route-based middleware protections (e.g. app.use('/admin/*', ...)), inconsistent URL decoding allowed protected static resources to be accessed without authorization.

The router used decodeURI, while serveStatic used decodeURIComponent. This mismatch allowed paths containing encoded slashes (%2F) to bypass middleware protections while still resolving to the intended filesystem path.

Details

The routing layer preserved %2F as a literal string, while serveStatic decoded it into / before resolving the file path.

Example:

Request: /admin%2Fsecret.html

  • Router sees: /admin%2Fsecret.html → does not match /admin/*
  • Static handler resolves: /admin/secret.html

As a result, static files under the configured static root could be served without triggering route-based protections.

This only affects applications that both:

  • Protect subpaths using route-based middleware, and
  • Serve files from the same static root using serveStatic.

This does not allow access outside the static root and is not a path traversal vulnerability.

Impact

An unauthenticated attacker could bypass route-based authorization for protected static resources by supplying paths containing encoded slashes.

Applications relying solely on route-based middleware to protect static subpaths may have exposed those resources.

Affected versions

npm

PackageVulnerableFixed in
hono
< 4.12.4
4.12.4

How to fix

Move to the fixed version or later with your package manager, update the lockfile, and run your tests. If the package only arrives through another dependency, upgrade that dependency first. If none of its releases pulls a fixed version yet, force the version with your package manager's override.

hono npm → 4.12.4

npm
npm install hono@4.12.4
yarn
yarn add hono@4.12.4
pnpm
pnpm add hono@4.12.4

Severity breakdown

CVSS 3.1 7.5

CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:N/A:N

Attack vector
Network
Attack complexity
Low
Privileges required
None
User interaction
None
Scope
Unchanged
Confidentiality
High
Integrity
None
Availability
None

Weakness

CWE-177: Improper Handling of URL Encoding (Hex Encoding)

The product does not properly handle when all or part of an input has been URL encoded.

How to prevent it
  • Architecture and Design: Avoid making decisions based on names of resources (e.g. files) if those resources can have alternate names.
  • Implementation: Assume all input is malicious. Use an "accept known good" input validation strategy, i.e., use a list of acceptable inputs that strictly conform to specifications. Reject any input that does not strictly conform to specifications, or transform it into something that does. When performing input validation, consider all potentially relevant properties, including length, type of input, the full range of acceptable values, missing or extra inputs, syntax, consistency across related fields, and conformance to business rules. As an example of business rule logic, "boat" may be syntactically valid because it only contains alphanumeric characters, but it is not valid if the input is only expected to contain colors such as "red" or "blue." Do not rely exclusively on looking for malicious or malformed inputs. This is likely to miss at least one undesirable input, especially if the code's environment changes. This can give attackers enough room to bypass the intended validation. However, denylists can be useful for detecting potential attacks or determining which inputs are so malformed that they should be rejected outright.
  • Implementation: Inputs should be decoded and canonicalized to the application's current internal representation before being validated (CWE-180). Make sure that the application does not decode the same input twice (CWE-174). Such errors could be used to bypass allowlist validation schemes by introducing dangerous inputs after they have been checked.

References

Timeline

  1. Published
  2. Last updated by the source
  3. Latest EPSS score
AdvisorySeverityWhy it's related
GHSA-x428-ghpx-8j92
@fastify/static vulnerable to route guard bypass via encoded path separators
Medium Linked by the source
GHSA-5r4p-p66f-jhc7
Hono: `serveStatic` decodes the request path a second time, leading to bypass of middleware on static paths
Medium Also affects hono
GHSA-hxh3-vqpv-xpqv
hono/jsx renders plain strings unescaped in boundary components, leading to XSS
Low Also affects hono
GHSA-gqvv-2mrq-wpjv
Hono: Incomplete fix for CVE-2026-39408: `toSSG()` still writes files outside the output directory
Medium Also affects hono
GHSA-g6gw-c38x-mqfc
Hono: Unbounded dot-notation nesting in `parseBody()` can cause memory exhaustion
Medium Also affects hono
GHSA-crvj-82cr-hjcx
Hono: Query parser reads parameters after the URL fragment, causing cache-key and proxy interpretation differentials
Medium Also affects hono
GHSA-f23p-vx2j-j53r
Hono: `memo()` retains SSR output across requests, leading to cross-user data disclosure
Medium Also affects hono
GHSA-79qm-7rj5-m7r9
Hono: Proxy Helper does not remove response headers listed in the `Connection` header
Low Also affects hono
Is this in your code?

MergeHarbor checks every repository's dependencies against this database, ranks what matters by exploitability and reachability, routes it to the owning team and opens the fix pull request.

Check your repos with MergeHarbor