Horizon Alert
Summary of the vulnerability and why it matters
A vulnerability in the @fastify/express compatibility layer could allow unauthenticated access to protected routes if specific configurations involving regular expression middleware within parameterized prefixes are used. This issue arises because the plugin may not correctly handle the parameterized prefix, causing the Express middleware to be skipped while the route handler still executes, potentially bypassing authentication or authorization checks. The problem is resolved in newer versions of the plugin.
- Middleware bypasses security checks on some routes.
- Critical for confirming if authentication is compromised.
- Verify if this compatibility layer is in use.
Attack Path
How an attacker could exploit the issue
An attacker could target applications using a compatibility layer for Express middleware within the Fastify web framework. If this layer is configured with a parameterized prefix and middleware is mounted using a regular expression, the Express matcher may incorrectly interpret the prefix. This bypasses intended security checks, allowing unauthenticated access to protected routes.
- Requires parameterized prefix and regex mount.
- Express middleware is unexpectedly skipped.
- Bypasses authentication on protected routes.
Live Threat
Current exploitation, exposure, and threat context
When @fastify/express is used with a parameterized prefix and regular-expression mounted middleware, applications could bypass authentication or authorization checks, exposing protected routes to unauthenticated clients.
- Protected routes could be exposed.
- Express matcher may fail to match requests.
- Unauthorized access to sensitive information.
Operational Fix
Recommended remediation, mitigation, and detection steps
This vulnerability in @fastify/express impacts applications using regular-expression mount paths within parameterized Fastify prefixes, potentially exposing protected routes. Infrastructure or platform teams managing Fastify deployments are likely responsible for assessing and remediating this issue. The first practical step is to identify all instances of the affected @fastify/express version, determine if they are exposed externally or host critical business functions, and then coordinate with application owners to plan an upgrade.
- Application and platform teams own the fix.
- Verify Express middleware usage with parameterized prefixes.
- Upgrade @fastify/express to version 4.0.10 or later.