Packages / @fastify/middie / Security
@fastify/middie has Improper Path Normalization when Using Path-Scoped Middleware
Affected releases · @fastify/middie
- 9.x9.0.0 – 9.1.0Fixed in 9.2.0
- 8.x8.0.0 – 8.3.3No fix on this line yet
On 9.x, the newest line:
npm install @fastify/middie@9.2.0Affected
9.0.0 – 9.1.0
5 releases
Fixed
9.2.0 – 9.3.6
8 releases, latest
Affected
8.0.0 – 8.3.3
7 releases
Is your project affected?
Paste your package.json, or type the range you declare for @fastify/middie. It is read in your browser and sent nowhere.
What happens
Summary
A path normalization inconsistency in @fastify/middie can result in authentication/authorization bypass when using path-scoped middleware (for example, app.use('/secret', auth)).
When Fastify router normalization options are enabled (such as ignoreDuplicateSlashes, useSemicolonDelimiter, and related trailing-slash behavior), crafted request paths may bypass middleware checks while still being routed to protected handlers.
Impact
An unauthenticated remote attacker can access endpoints intended to be protected by middleware-based auth/authorization controls by sending specially crafted URL paths (for example, //secret or /secret;foo=bar), depending on router option configuration.
This may lead to unauthorized access to protected functionality and data exposure.
Affected versions
Confirmed affected:
@fastify/middie@9.1.0All versions prior to the patch are affected.
Patched versions
Fixed in: 9.2.0
Details
The issue is caused by canonicalization drift between:
@fastify/middiepath matching forapp.use('/prefix', ...), andFastify/find-my-way route lookup normalization.
Because middleware and router did not always evaluate the same normalized path, auth middleware could be skipped while route resolution still succeeded.
Workarounds
Until patched version is deployed:
Avoid relying solely on path-scoped middie guards for auth/authorization.
Enforce auth at route-level handlers/hooks after router normalization.
Disable risky normalization combinations only if operationally feasible.
Resources
Fluid Attacks Disclosure Policy: fluidattacks.com/advisories/policy
Fluid Attacks advisory URL: fluidattacks.com/advisories/jimenez
Credits
Cristian Vargas (Fluid Attacks Research Team) — discovery and report.
Oscar Uribe (Fluid Attacks) — coordination and disclosure.