Fastify: Middleware bypass in @fastify/middie (CVE-2026-132131)
A path normalization vulnerability in @fastify/middie versions 8.3.0 through 9.3.6 allows for the bypass of path-scoped middleware by using array-based mount paths with trailing slashes or root path elements.
CVE search metadata
CVE search record: CVE-2026-132131. Severity: high. CVSS: 7.4. KEV: no. Product: @fastify/middie. Brief: Fastify: Middleware bypass in @fastify/middie (CVE-2026-132131). Brief link: https://feed.craftedsignal.io/briefs/2026-11-fastify-middie-bypass-cve-2026-132131/
Triage facts
Revision 1- Applicability
- @fastify/middie
- Evidence
- Unknown
- Severity
- Medium
- Sources
- 2 public sources
- Freshness
- Revision 1Nov 19, 13:46 UTC
- Vulnerabilities
- 1 CVE
- Source quality
- A2Roughly even chance
Overview
@fastify/middie, a middleware engine for the Fastify framework, contains a path normalization vulnerability. In versions 8.3.0 through 9.3.6, the internal helper that normalizes a path-scoped middleware's mount path only handles string inputs, but the .use() method also accepts an array of mount paths and passes it through unchanged, causing the normalization to silently do nothing. As a result, a trailing slash on an array element survives into the generated route-matching regular expression, and an element that is exactly the root path is dropped entirely.
Attack Chain
Applications are affected when they mount middleware on an array of paths where an element ends with a slash (including those introduced by a plugin prefix) or is exactly the root path. Requests to subroutes of these affected mount paths skip the intended path-scoped middleware, such as authentication, authorization, or rate limiting, while Fastify's router still dispatches them to the handler.
Impact
An unauthenticated client may reach protected routes by bypassing security middleware that was intended to restrict access.
Recommendation
- The issue is fixed in @fastify/middie 9.3.7; users should upgrade to 9.3.7 or later.
- As a workaround, enforce authorization in a Fastify hook such as preHandler that runs after routing, and avoid array mount paths with a trailing slash element for security-relevant middleware.