Improper Authentication Affecting @fastify/express package, versions >=4.0.7 <4.0.10


Severity

Recommended
0.0
critical
0
10

CVSS assessment by Snyk's Security Team. Learn more

Threat Intelligence

EPSS
0.74% (56th 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 Learn

Learn about Improper Authentication vulnerabilities in an interactive lesson.

Start learning
  • Snyk IDSNYK-JS-FASTIFYEXPRESS-23050796
  • published30 Nov 2026
  • disclosed21 Nov 2026
  • creditkleju13

Introduced: 21 Nov 2026

NewCVE-2026-133867  (opens in a new tab)
CWE-287  (opens in a new tab)

How to fix?

Upgrade @fastify/express to version 4.0.10 or higher.

Overview

@fastify/express is an Express compatibility layer for Fastify

Affected versions of this package are vulnerable to Improper Authentication via the prefixRegExp function in index.js, which fails to rewrite regular-expression mount paths to account for a parameterized Fastify plugin prefix. When middleware is mounted with a RegExp (e.g. app.use(/^\/private/, authMiddleware)) inside a plugin registered under a parameterized prefix (e.g. /tenant/:tenantId), the Express matcher is built with the literal parameter token (:tenantId) rather than a concrete value, so the mount never matches the real request path. Express silently skips the middleware while Fastify still dispatches the route handler, allowing unauthenticated clients to reach routes that rely on RegExp-mounted Express middleware for authentication or authorization.

Workaround

Enforce authentication in a Fastify hook (such as preHandler) that runs after the router resolves the request, or avoid RegExp mount paths under parameterized plugin prefixes by using a string mount path or moving the parameter out of the prefix.

CVSS Base Scores

version 4.0
version 3.1