/

CVE-2026-132128

Severity:

HIGH RISK

(7.4)

Authorization Bypass (CWE-863) in Fastify Middie Middleware

CVE-2026-132128

Awaiting Analysis

Vulnerability type

Category:

Authorization Bypass

CWE:

CWE-178, CWE-863

Impact:

Unauthorized access to protected handlers

Severity:

HIGH RISK

(7.4)

CVSS version:

3.1

Catch this CVE while code is being written

Detect vulnerable code directly in pull requests, so CVEs are fixed before merge.

Summary

A path-matching inconsistency in @fastify/middie can cause path-scoped middleware to be skipped even though Fastify routes a request to the protected handler. In affected configurations, an unauthenticated client may reach that handler without checks such as authentication, authorization, or rate limiting.

Affected context

The issue affects applications using @fastify/middie when Fastify routing is configured with caseSensitive: false and a protected middleware mount path contains the letter k. Fastify's router applies Unicode-aware lowercasing, while middie's path-matching regular expression does not handle the same non-ASCII character equivalently, creating a mismatch between routing and middleware selection.

Exploit preconditions

  • Attack surface: HTTP requests to routes protected by path-scoped middleware
  • Required access: An unauthenticated client able to send requests to the application
  • Configuration required: Fastify routing uses caseSensitive: false, and the protected mount path contains the letter k
  • Trigger point: Path matching for a request handled by Fastify's router and middie's middleware matcher
  • Why exploitation is possible: The router and middleware matcher normalize and compare the path differently, so routing can select a protected handler while the middleware does not match and run

Why this happens

This is a path canonicalization and authorization enforcement inconsistency. Fastify's router uses Unicode-aware lowercasing when case-insensitive routing is enabled, while middie's regular-expression matching for mounted middleware does not fold non-ASCII characters the same way. This behavior relates to CWE-178: Improper Handling of Case Sensitivity and can result in CWE-863: Incorrect Authorization when security middleware is skipped for a handler that relies on it.

Potential impact

  • Unauthenticated users may reach handlers intended to be protected
  • Authorization checks provided by path-scoped middleware could be bypassed
  • Rate limits or other middleware-based controls may not run
  • Sensitive data or operations may become accessible, depending on the handler

General mitigation guidance

Reduce reliance on path-scoped middleware as the sole authorization boundary. Apply authorization checks in routing hooks that run for the selected handler, such as a post-routing pre-handler hook, and use consistent path normalization across routing and middleware. Keeping case-sensitive routing enabled is another pattern that avoids this particular mismatch when compatible with application requirements. Apply least privilege to handlers and services so that a missed middleware check has a limited effect.

How teams detect issues like this

Review applications that combine case-insensitive routing with path-scoped security middleware, especially where protected mount paths contain k. Test that routing and middleware selection agree for equivalent Unicode and ASCII path representations. Static analysis and code review can flag authorization implemented only in middleware mounts, as well as mismatched normalization logic. Policy checks can require authorization hooks on sensitive routes and regression tests for path-matching behavior.

Sources

SourceLink
cna.openjsf.orgcna.openjsf.org/security-advisories.html
github.comgithub.com/fastify/middie/security/advisories/GHSA-r5h5-r25j-5vhr

Frequently asked

questions

It applies when case-insensitive Fastify routing is combined with path-scoped middleware protecting a mount path that contains the letter k.

The described bypass can be triggered by an unauthenticated client that can send requests to the application, provided the affected routing and middleware conditions are present.

Enforce authorization in a Fastify hook that runs after routing, rather than relying solely on path-scoped middleware. Consistent path normalization and case-sensitive routing, where suitable, can also avoid the mismatch.

Test that security middleware runs for every route representation the router accepts, and review path normalization and authorization boundaries whenever routing behavior is configured.

Find out what's already
exploitable in your codebase.