Improper Handling of Case Sensitivity Affecting @fastify/middie package, versions <9.3.7


Severity

Recommended
0.0
critical
0
10

CVSS assessment by Snyk's Security Team. Learn more

Threat Intelligence

EPSS
0.47% (42nd percentile)

Do your applications use this vulnerable package?

In a few clicks we can analyze your entire application and see what components are vulnerable in your application, and suggest you quick fixes.

Test your applications
  • Snyk IDSNYK-JS-FASTIFYMIDDIE-22743505
  • published23 Nov 2026
  • disclosed19 Nov 2026
  • creditRootSys Research

Introduced: 19 Nov 2026

NewCVE-2026-132128  (opens in a new tab)
CWE-178  (opens in a new tab)

How to fix?

Upgrade @fastify/middie to version 9.3.7 or higher.

Overview

@fastify/middie is a Middleware engine for Fastify

Affected versions of this package are vulnerable to Improper Handling of Case Sensitivity via Unicode case folding in the middleware path-matching engine (lib/engine.js). When the Fastify router is configured with caseSensitive: false, the router lowercases request paths using a Unicode-aware toLowerCase() that maps the KELVIN SIGN character (U+212A) to the ASCII letter k, but middie matches path-scoped middleware mount paths with a case-insensitive regular expression that does not apply the same folding. An attacker can send a request whose path encodes a k as the percent-encoded KELVIN SIGN (e.g. /api/%E2%84%AAeys instead of /api/keys), causing the router to dispatch the request to the protected handler while any middleware mounted at that path - such as authentication, authorization, or rate limiting - never matches and is skipped entirely.

Note: This is only exploitable when the application sets caseSensitive: false and mounts middleware on a path containing the letter k.

Workaround

Enforce authorization in a Fastify hook such as preHandler that runs after the router has resolved the request, or keep routing case-sensitive (the default).

CVSS Base Scores

version 4.0
version 3.1