Incorrect Regular Expression Affecting @fastify/express package, versions >=4.0.3 <4.0.14


Severity

Recommended
0.0
critical
0
10

CVSS assessment by Snyk's Security Team. Learn more

Threat Intelligence

EPSS
0.54% (39th 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 Incorrect Regular Expression vulnerabilities in an interactive lesson.

Start learning
  • Snyk IDSNYK-JS-FASTIFYEXPRESS-23050798
  • published30 Nov 2026
  • disclosed26 Nov 2026
  • creditMatteo Collina

Introduced: 26 Nov 2026

NewCVE-2026-135230  (opens in a new tab)
CWE-185  (opens in a new tab)

How to fix?

Upgrade @fastify/express to version 4.0.14 or higher.

Overview

@fastify/express is an Express compatibility layer for Fastify

Affected versions of this package are vulnerable to Incorrect Regular Expression via the request path decoding logic, which decodes %E2%80%A8 (U+2028, line separator) and %E2%80%A9 (U+2029, paragraph separator) to their raw Unicode forms before passing the path to Express middleware. Because JavaScript regular expressions treat U+2028 and U+2029 as line terminators, a RegExp mount path that relies on the dot metacharacter (e.g. /^\/admin(?:\/.*)?$/) fails to match a request path containing these characters. Fastify's own router still routes the request to its handler, so any middleware - including authentication guards - mounted on that regular-expression path is skipped entirely. An attacker can exploit this to bypass authentication or other middleware-based access controls on routes guarded by a regular-expression mount.

Note: This is only exploitable when middleware is mounted using a regular-expression path that relies on the dot metacharacter; string mount paths are not affected.

Workaround

Use string mount paths, replace . with [^] or use the s (dotAll) flag in RegExp mount paths, or enforce authentication in a Fastify hook such as preHandler that runs after the router resolves the request.

CVSS Base Scores

version 4.0
version 3.1