Middleware bypass in @fastify/express via optional group mount paths
Key facts
- Attack vector
- Network
- Privileges required
- None
- User interaction
- None
- Attack complexity
- High
- Impact type
- Security bypass
- Confidentiality · integrity · availability
- High · High · None
- Fix status
- Fixed
Attack profile from CVSS 3.1 · CNA. Fix status from CNA. Impact type from CWE-863.
Summary
@fastify/express from 4.0.5 before 4.0.14 mishandles mount paths that begin with an Express 5 optional group. The path is treated as relative and gets a slash prepended, so the middleware is mounted on a path that does not match the real request paths and never runs (CWE-863). An attacker can bypass authentication or other middleware-based access controls on the affected routes, while the Fastify routes still resolve to their handlers.
Written with Claude Haiku 5.5 from the sources below · 2026-11-26
Description from the CNA
@fastify/express is the plugin that lets an application run Express middleware and Express applications inside the Fastify web framework. In versions from 4.0.5 before 4.0.14, a mount path that begins with an Express 5 optional leading segment written as a group is treated as relative and has a slash prepended when it is joined to the plugin prefix, which changes what the pattern matches so the middleware ends up mounted on a path that no longer corresponds to the real request paths. The middleware therefore never runs for requests that match the intended routes, while the Fastify routes still resolve to their handlers. An attacker can use this to bypass authentication or other middleware-based access controls on the affected routes. The issue is fixed in @fastify/express 4.0.14, and users should upgrade to 4.0.14 or later. As a workaround, mount the middleware on each path spelling explicitly, or enforce authentication in a Fastify hook such as preHandler that runs after the router resolves the request.
Why it matters now
SSVC decision points
Not available: CISA has not published SSVC decision points for this record.
Affected products
| Vendor | Product | Affected versions | Fixed in | Status | Source |
|---|---|---|---|---|---|
| @fastify/express | @fastify/express | 4.0.5 to before 4.0.14 | 4.0.14 | Patch available | CNA |
- @fastify/express Vendor@fastify/express Affected 4.0.5 to before 4.0.14 Fixed in 4.0.14 Patch available CNA
Remediation
Upgrade @fastify/express to 4.0.14 or later, which fixes the issue. As a workaround, mount the middleware on each path spelling explicitly, or enforce authentication in a Fastify hook such as preHandler that runs after the router resolves the request.
Written with Claude Haiku 5.5 from the sources below · 2026-11-26
- Fix · CNA @fastify/express (@fastify/express) Fixed in 4.0.14
Fixed in the same release
Records fixed by the same vendor advisory or release, as the CNA lists them.
- Release ·
@fastify/express 4.0.14
5 records Highest priority Priority MEDIUM 1 MEDIUM, 4 LOW
Other records, highest priority first
- TI-2026-99002 Middleware bypass via empty route parameters in @fastify/expressPriority MEDIUM 41
- TI-2026-99003 Middleware bypass in @fastify/express with case-insensitive routingPriority LOW 33
- TI-2026-99000 Middleware bypass in @fastify/express via nested mount path arraysPriority LOW 33
Timeline
- 2026-11-26 Threatist record created from CVE-2026-135270
References
More @fastify/express vulnerabilities
- TI-2026-96437 @fastify/express path-scoped middleware bypass via URL decoding mismatch CVSS 3.1CRITICAL 9.1
- TI-2026-96435 Path-scoped middleware bypass in @fastify/express skips authentication checks CVSS 3.1CRITICAL 9.1
- TI-2026-96434 Middleware bypass in @fastify/express via empty route parameters CVSS 3.1CRITICAL 9.1
- TI-2026-96433 @fastify/express middleware bypass via RegExp mounts under parameterized prefix CVSS 3.1CRITICAL 9.1
- TI-2026-81130 Middleware bypass in @fastify/express via absolute-form URLs CVSS 3.1CRITICAL 9.1
- TI-2026-99002 Middleware bypass via empty route parameters in @fastify/express CVSS 3.1CRITICAL 9.1
Sources
This product uses the NVD API but is not endorsed or certified by the NVD. Sources and licences