Horizon Alert
Summary of the vulnerability and why it matters
@fastify/middie, a middleware engine for Fastify web applications, contains a critical vulnerability that could allow unauthenticated requests to bypass security controls like authentication and rate limiting. This occurs when the middleware's configured path does not align with the router's path, leading to the middleware being silently skipped while the route handler still executes. The issue is resolved in version 9.3.6 and later.
- Security checks can be bypassed by web requests.
- Essential for confirming if your web applications are exposed.
- Mitigate risk by verifying use and upgrading middleware.
Attack Path
How an attacker could exploit the issue
An attacker could bypass path-scoped middleware, like authentication or authorization checks, by sending a specially crafted unauthenticated request. This occurs because the middleware engine incorrectly combines path segments, causing the middleware to be skipped while the intended route handler still executes. This bypass could allow an attacker to access sensitive functionality.
- No authentication required.
- Triggered by sending a request.
- Bypasses security middleware.
Live Threat
Current exploitation, exposure, and threat context
Path-scoped middleware, such as authentication, authorization, or rate limiting, could be bypassed by unauthenticated requests when the @fastify/middie library incorrectly joins mount paths. This could occur when the scope prefix ends in a slash, or for array and non-leading slash mount paths, allowing direct access to route handlers while silently skipping these security controls.
- Unprotected routes could be accessed.
- Requests could bypass security middleware.
- Unauthorized access to application features.
Operational Fix
Recommended remediation, mitigation, and detection steps
This vulnerability in @fastify/middie could allow unauthenticated requests to bypass security controls like authentication and authorization. Platform or application teams responsible for Fastify deployments should first identify all instances of the affected middleware, confirm their exposure and criticality, and then plan remediation. As a workaround, security checks can be implemented in Fastify hooks that execute after routing.
- Platform/Application teams should own the issue.
- Verify affected middleware instances and exposure.
- Plan remediation or implement workaround hooks.