Summary
In @fastify/express 4.0.7 through 4.0.9, middleware mounted with a regular expression inside a plugin with a parameterized prefix can be skipped while Fastify still runs the route handler. The source assigns a CVSS 3.1 score of 9.1 (critical severity), and the vendor states it is fixed in version 4.0.10.
What happened
@fastify/express is a compatibility layer that lets Express middleware run inside Fastify. In versions 4.0.7 through 4.0.9, the plugin does not rewrite regular-expression mount paths to account for a parameterized plugin prefix. As a result, when middleware is mounted with a regular expression inside a plugin registered under a parameterized prefix, the Express matcher treats the prefix parameter as literal text and never matches the real request path. Express then silently skips that middleware while Fastify still runs the route handler. No special configuration is needed beyond a parameterized prefix and a regular-expression mount. The associated weaknesses are CWE-287 and CWE-436.
Why it matters
If an application relies on regular-expression mounted middleware for authentication or authorization inside a plugin with a parameterized prefix, protected routes are exposed to unauthenticated clients. The CVSS 3.1 score is 9.1 (vector CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:H/A:N, source: CNA openjs) and the severity is critical. CISA's KEV catalog does not list this vulnerability as exploited, and the source does not indicate active exploitation.
Affected products and versions
@fastify/express, versions >= 4.0.7 and < 4.0.10 (that is, 4.0.7 through 4.0.9). Version 4.0.10 is listed as unaffected.
| Product | Versions | Fixed in |
|---|---|---|
| @fastify/express @fastify/express | >= 4.0.7, < 4.0.10 | — |
| @fastify/express @fastify/express | 4.0.10 | 4.0.10 |
Action recommended by the source
The vendor recommends upgrading to @fastify/express 4.0.10 or later. More information in the vendor advisory: https://github.com/fastify/fastify-express/security/advisories/GHSA-84w6-xrf3-f8q8
Fixed in: 4.0.10
Sources and references
- https://github.com/fastify/fastify-express/security/advisories/GHSA-84w6-xrf3-f8q8 — CVE Program
- https://cna.openjsf.org/security-advisories.html — CVE Program
Weaknesses (CWE): CWE-287, CWE-436
Relevant change history
Advisory correction
The preliminary version was replaced by the full write-up.
Published
Preliminary advisory published.