GHSA-W877-HJCP-88RC
@fastify/express vulnerable to path-scoped middleware bypass via request URL decoding and normalization mismatches
Texto original en inglés · Ver en español
CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:H/A:N
Fuente: GitHub
Ciclo de vida de la vulnerabilidad
| Fecha | Fase | Evento | Detalle |
|---|---|---|---|
| Divulgación | Publicada | GHSA-W877-HJCP-88RC divulgada · CVSS 9.1 (GitHub) | |
| Monitoreo | Detectada | Ingresó al índice | |
| Monitoreo | Verificada | Última verificación contra las fuentes |
Impact
`@fastify/express` passes Express a request URL that does not match the path Fastify's router (find-my-way) dispatched, so path-scoped Express middleware can be skipped while the route handler still runs. On a scoped route such as `app.use('/tenant/:id/admin', authMiddleware)`, an unauthenticated request reaches the handler while the middleware (authentication, authorization, rate limiting) is skipped. No special configuration is required.
Three request forms trigger the mismatch. Since 4.0.3, the plugin percent-decodes the URL before Express parses it, so a backslash combined with whitespace or `#` (for example `/tenant/x%5C%20/admin`) makes Express rewrite `\` to `/` and miss parameterized, prefixed and RegExp mounts, and `%25` is decoded twice, so middleware and handler see different parameter and query values (`/acct/%2561lice` gives `alice` in middleware and `%61lice` in the handler). In every release, a request target starting with `*` (for example `GET *admin`) is routed to `/admin` by Fastify while Express does not match a mount on `/admin`, which skips static mounts as well.
Patches
Upgrade to `@fastify/express` 4.0.10 or later. Express now receives the path the router matched, request targets that do not start with `/` are rejected with a 400, and `req.url` keeps the query string encoded. RegExp mount paths are matched against the percent-encoded path, as in Express.
Workarounds
Enforce authentication in a Fastify hook (such as `preHandler`) that runs after the router has resolved the request, and base the decision on the matched route (`request.routeOptions.url`). To block only the two bypasses, reject request targets that start with `*` or whose path contains a backslash in an `onRequest` hook registered before `@fastify/express`.
Desglose de métricas
Rangos afectados
Estado del parche por paquete
| Paquete / producto | Estado | Corregida en | Desde divulgación | Última versión |
|---|---|---|---|---|
npm@fastify/express |
Sin parche | — | — | 4.0.9 afectada |
4.0.10Arsenal público
Sin exploits, módulos ni PoC públicos conocidos a la fecha de verificación.
https://github.com/fastify/fastify-express/security/advisories/GHSA-w877-hjcp-88rcLas referencias externas se muestran para copiar: cve.llama.ec no lo redirige a otros sitios.
