# GHSA-4C7F-6888-3VRH: @fastify/middie vulnerable to middleware bypass via mount paths without a leading slash in prefixed plugins

- Database: GitHub
- Severity: CVSS 7.4 (High)
- Published: 2026-11-26
- Modified: 2026-11-26

## Tracked as

- [CVE-2026-135205](https://cve.now/CVE-2026-135205.md): Fastify Middie middleware bypass in prefixed plugin mount paths

## Affected versions

- @fastify/middie (npm): from 9.3.6, fixed in 9.3.10

## Description

### Impact

Inside a plugin registered with a prefix, Fastify joins a route path that does not start with `/` directly to the prefix: `get('secret')` under the prefix `/api` is served at `/apisecret`. Since 9.3.6 ([GHSA-5p92-8765-9fv8](https://github.com/fastify/middie/security/advisories/GHSA-5p92-8765-9fv8)), `@fastify/middie` puts a slash between the prefix and such a mount path instead, so `use('secret', auth)` is mounted on `/api/secret`. `GET /apisecret` then runs the route handler without the middleware, and `use(':id', auth)` with `get(':id')` is bypassed the same way by `GET /api42`.

Only route and mount paths written without a leading slash inside a prefixed plugin are affected.

### Patches

Upgrade to `@fastify/middie` 9.3.10 or later.

### Workarounds

Start route and mount paths with `/`, or enforce authentication in a Fastify hook (such as `preHandler`) that runs after the router has resolved the request.

### References

- [GHSA-5p92-8765-9fv8](https://github.com/fastify/middie/security/advisories/GHSA-5p92-8765-9fv8) (CVE-2026-112712), the prefix join fix that introduced this

## References

- https://github.com/fastify/middie/security/advisories/GHSA-4c7f-6888-3vrh

Page: https://cve.now/GHSA-4C7F-6888-3VRH

Wrong or missing data? Send feedback: POST https://cve.now/api/v1/feedback (see https://cve.now/agents#feedback).
