CVE-2026-135280: @fastify/express vulnerable to middleware bypass with case-insensitive routing via Unicode mount paths and case-sensitive matchers
@fastify/express is the plugin that lets an application run Express middleware and Express applications inside the Fastify web framework. In versions before 4.0.14, when an application enables case-insensitive routing, middleware mounted on a path can still be skipped in two cases: a string mount path or plugin prefix containing a Unicode character whose case folding differs from a plain lowercase conversion fails to match the lowercased request path, and a matcher that stays case-sensitive inside an Express Router or application, such as a regular expression without the ignore-case flag or an explicitly case-sensitive router, only matches its own casing. In both cases a request reaches the Fastify route handler while the path-scoped middleware does not run. An attacker can use this to bypass authentication or other middleware-based access controls on the affected routes, and only applications that enable case-insensitive routing are affected. The issue is fixed in @fastify/express 4.0.14, and users should upgrade to 4.0.14 or later. As a workaround, enforce authentication in a Fastify hook such as preHandler that runs after routing, avoid such Unicode characters in mount paths, and match case-insensitively inside Express routers and applications.
Affected Software
Remediation
Recommended actions to resolve this vulnerability, in priority order.
- Upgrade
Upgrade
@fastify/expressto a version that resolves this vulnerability.Fixed in 4.0.14 - Compensating control
Enforce authentication in a Fastify hook such as preHandler that runs after routing.
- Compensating control
Avoid Unicode characters in middleware mount paths and plugin prefixes.
- Compensating control
Match case-insensitively inside Express routers and applications.
Event History
Frequently Asked Questions
Which applications are exposed?
Only applications using @fastify/express before 4.0.14 that have enabled case-insensitive routing are affected. Exposure exists where authentication or other access controls rely on middleware mounted on affected paths.
What does an attacker need to exploit this?
The attacker needs network access to send a crafted request; no privileges or user interaction are required. Exploitation depends on either Unicode characters in a string mount path or plugin prefix with unusual case-folding behavior, or a case-sensitive matcher inside an Express Router or application.
How can access controls be protected if an immediate upgrade is not possible?
Enforce authentication in a Fastify hook such as preHandler, which runs after routing. Also avoid the affected Unicode characters in mount paths and avoid case-sensitive matchers where case-insensitive routing is enabled.
How can teams determine whether they are affected?
Check whether the application uses @fastify/express earlier than 4.0.14 and enables case-insensitive routing. Then review middleware mount paths and plugin prefixes for Unicode characters, and review Express routers or applications for regular expressions without an ignore-case flag or explicitly case-sensitive routing.