GHSA-J7QM-JHPC-MJ26
@fastify/swagger-ui vulnerable to documentation authentication bypass via the unprotected /static route
CVSS:3.1/AV:N/AC:H/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-J7QM-JHPC-MJ26 divulgada · CVSS 3.7 (GitHub) | |
| Monitoreo | Detectada | Ingresó al índice | |
| Monitoreo | Verificada | Última verificación contra las fuentes |
Impact
`@fastify/swagger-ui` lets applications protect the documentation with `uiHooks` (the `onRequest` and `preHandler` authentication hooks described in the README). Those hooks are applied to every route the plugin adds except the `@fastify/static` instance mounted at `<routePrefix>/static/`. When `baseDir` is set, which the README recommends for bundling the UI, that instance serves every file in `baseDir`, so a file the operator protected at `<routePrefix>/<file>` is also reachable without credentials at `<routePrefix>/static/<file>`. An unauthenticated client who knows or guesses a file name can read specification files that were meant to stay behind the documentation login. Access is read-only, and the `/json`, `/yaml` and UI page routes stay protected. Versions 2.1.0 through 6.1.4 are affected.
Patches
Upgrade to `@fastify/swagger-ui` 6.1.5 or later, which applies the `uiHooks` to the `/static` route as well. The bundled Swagger UI assets are now served behind the same hooks. Basic and cookie or session authentication keep working because the browser sends same-origin credentials for those requests; a header-only bearer scheme or a proxy that injects authentication may need the assets on a separate public path or an authentication-aware same-origin proxy.
Workarounds
Enforce authentication in a Fastify hook registered before `@fastify/swagger-ui` so it also runs for the `/static` route, or do not set `baseDir` (without it, only the public bundled assets are served under `/static/`).
References
- GHSA-62jr-84gf-wmg4
https://github.com/fastify/fastify-swagger-ui/security/advisories/GHSA-62jr-84gf-wmg4(CVE-2024-22207), an earlier file exposure in `@fastify/swagger-ui`'s static serving.
Desglose de métricas
Rangos afectados
Estado del parche por paquete
| Paquete / producto | Estado | Corregida en | Desde divulgación | Última versión |
|---|---|---|---|---|
npm@fastify/swagger-ui |
Sin parche | — | — | 6.1.3 afectada |
6.1.5Arsenal público
Sin exploits, módulos ni PoC públicos conocidos a la fecha de verificación.
https://github.com/fastify/fastify-swagger-ui/security/advisories/GHSA-j7qm-jhpc-mj26Las referencias externas se muestran para copiar: cve.llama.ec no lo redirige a otros sitios.
