# GHSA-J373-FCW4-2CCV: @fastify/express vulnerable to middleware bypass via mount paths starting with an optional group

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

## Tracked as

- [CVE-2026-135270](https://cve.now/CVE-2026-135270.md): Fastify Express authentication bypass in middleware path mounting

## Affected versions

- @fastify/express (npm): from 4.0.5, fixed in 4.0.14

## Description

### Impact

Express 5 writes an optional leading segment as a group, for example `fastify.use('{/:lang}/admin', auth)`, which Express matches against `/admin` and `/en/admin`. When `@fastify/express` joins a mount path with the plugin prefix ([GHSA-f44m-4qwg-5587](https://github.com/fastify/fastify-express/security/advisories/GHSA-f44m-4qwg-5587)), it treats a path that does not start with `/` as relative and puts a slash in front of it, so the mount becomes `/{/:lang}/admin`, which only matches `//admin` and `//en/admin`. Under a prefix ending in a slash, such as `/api/`, it becomes `/api/{/:lang}/admin`. The middleware then never runs for `GET /admin/users`, `GET /en/admin/users` or their prefixed equivalents, while the Fastify routes still do.

At the top level this is a regression in 4.0.10; under a prefix ending in a slash it affects every version since 4.0.5, the first to use Express 5.

### Patches

Upgrade to `@fastify/express` 4.0.14 or later.

### Workarounds

Mount the middleware on each spelling explicitly (`fastify.use(['/admin', '/:lang/admin'], auth)`), or enforce authentication in a Fastify hook (such as `preHandler`) that runs after the router has resolved the request.

### References

- [GHSA-f44m-4qwg-5587](https://github.com/fastify/fastify-express/security/advisories/GHSA-f44m-4qwg-5587) (CVE-2026-129504), the prefix and mount path join fix

## References

- https://github.com/fastify/fastify-express/security/advisories/GHSA-j373-fcw4-2ccv

Page: https://cve.now/GHSA-J373-FCW4-2CCV

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