# GHSA-WJM9-696X-9549: @fastify/express vulnerable to middleware bypass via nested arrays of mount paths

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

## Tracked as

- [CVE-2026-135264](https://cve.now/CVE-2026-135264.md): Fastify Express middleware bypass via nested mount path arrays

## Affected versions

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

## Description

### Impact

Express accepts nested arrays of mount paths and flattens them, so `fastify.use([ADMIN_PATHS, '/billing'], auth)` with `const ADMIN_PATHS = ['/admin', '/settings']` mounts the middleware on all three paths. `@fastify/express` only rewrites the top level of the array ([GHSA-3wf5-7852-vcfq](https://github.com/fastify/fastify-express/security/advisories/GHSA-3wf5-7852-vcfq)): the paths in a nested array are not prefixed in a plugin registered with a prefix, so the middleware never runs for `GET /api/admin/users`, and a nested RegExp keeps its `g` or `y` flag, so Express matches it statefully and skips the middleware on every other request. A nested RegExp is also not matched case-insensitively with `caseSensitive: false`, and nested dynamic paths are not covered by the empty-segment check of [GHSA-662w-h4p6-jq4p](https://github.com/fastify/fastify-express/security/advisories/GHSA-662w-h4p6-jq4p).

### Patches

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

### Workarounds

Flatten mount path arrays before passing them to `fastify.use()` (`fastify.use([...ADMIN_PATHS, '/billing'], auth)`), or enforce authentication in a Fastify hook (such as `preHandler`) that runs after the router has resolved the request.

### References

- [GHSA-3wf5-7852-vcfq](https://github.com/fastify/fastify-express/security/advisories/GHSA-3wf5-7852-vcfq) (CVE-2026-6556), the non-string mount path fix

## References

- https://github.com/fastify/fastify-express/security/advisories/GHSA-wjm9-696x-9549

Page: https://cve.now/GHSA-WJM9-696X-9549

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