GHSA-H25J-2P75-QJ33
`mount()` and `app.mount()` forward a wrong path when a custom `getPath` adds a prefix, bypassing middleware scoped inside the mount prefix
CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:L/I:N/A:N
Fuente: GitHub
Ciclo de vida de la vulnerabilidad
| Fecha | Fase | Evento | Detalle |
|---|---|---|---|
| Divulgación | Publicada | GHSA-H25J-2P75-QJ33 divulgada · CVSS 5.3 (GitHub) | |
| Divulgación | Modificada | Última actualización del registro | |
| Remediación | Parche 4.13.18 | hono · 0 d desde divulgación | |
| Monitoreo | Detectada | Ingresó al índice | |
| Monitoreo | Verificada | Última verificación contra las fuentes |
Summary
The fix for GHSA-4m76-xfj5-7975 in 4.13.16 made `mount()` and `app.mount()` remove the mount prefix from the raw request path by counting the segments of the routed path. When a custom `getPath` adds a prefix to the routed path, for example the host name for host-based routing, the routed path has more segments than the raw path, and one segment too many is removed. The mounted application then receives a different path from the one the outer application routed and protected.
Details
With `getPath` returning `/<host>/<path>` and a mount on `/<host>`, a request for `/admin/secret` reached the mounted application as `/secret`, and a request for `/public/admin/secret` reached it as `/admin/secret`. The outer application routed on `/<host>/public/admin/secret`, so middleware registered on `/<host>/admin/*` did not run, while the mounted application served its `/admin/secret` route.
The forwarded path is now taken from the routed path (`c.req.path`) with the matched prefix removed, so the outer and the mounted application always see the same path. Because the routed path is decoded, the middleware checks that turning it back into a URL does not change its meaning, and responds with 400 otherwise: encoded dot segments, repeated trailing slashes under `strict: false` that a mounted Hono application would strip again, a request URL whose authority contains `?`, `#` or `\`, and percent escapes that do not survive re-parsing. A mount path with an optional regular expression parameter such as `/:id{[0-9]+}?` is not supported and throws; register `/mount` and `/mount/:id{[0-9]+}` separately.
The original percent encoding of the forwarded path is not preserved, for example `%41` can become `A`. Standard `getPath` is unaffected apart from this.
Impact
An unauthenticated client can reach a route of a mounted application that the outer application protects with path-scoped middleware, when the application uses a custom `getPath` that prepends a prefix to the path.
This issue affects applications on 4.13.16 and 4.13.17 that use `mount()` or `app.mount()` together with a custom `getPath` that adds a prefix, and rely on middleware registered on a sub-path inside the mount prefix for authentication or authorization.
Desglose de métricas
Rangos afectados
Estado del parche por paquete
| Paquete / producto | Estado | Corregida en | Desde divulgación | Última versión |
|---|---|---|---|---|
npmhono |
Corregida | 4.13.18 | 0 d | 4.13.19 no afectada |
4.13.18Arsenal público
Sin exploits, módulos ni PoC públicos conocidos a la fecha de verificación.
https://github.com/honojs/hono/security/advisories/GHSA-h25j-2p75-qj33Las referencias externas se muestran para copiar: cve.llama.ec no lo redirige a otros sitios.
