Summary
In @fastify/express 4.0.5 through 4.0.9, a request with an empty dynamic segment can run a Fastify route handler while the Express middleware mounted on that pattern is skipped. The source assigns a CVSS 3.1 score of 9.1 (critical severity) and states a fix in version 4.0.10.
What happened
@fastify/express is a compatibility layer that lets Express middleware run inside Fastify. In versions 4.0.5 through 4.0.9, the plugin matches path-scoped Express middleware with a matcher that requires a non-empty value for a dynamic segment, while Fastify's router accepts an empty parameter or wildcard value. When a route and an Express middleware mount share a dynamic pattern, a request with an empty segment matches the Fastify route and runs the handler, but the middleware mounted on that pattern is skipped. On a scoped mount, an unauthenticated request could reach a protected handler. No special configuration is required. The associated weaknesses are CWE-287 and CWE-436.
Why it matters
Skipping the middleware may allow unauthenticated requests to reach handlers that rely on it for protection. The source states that the practical impact depends on what the empty value selects in each application. 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, assigned by CNA:openjs) and severity is critical. According to CISA's KEV catalog, no known exploitation is recorded; the source provides no evidence of active exploitation.
Affected products and versions
@fastify/express, versions >= 4.0.5 and < 4.0.10 (affected). Version 4.0.10 is listed as unaffected.
| Product | Versions | Fixed in |
|---|---|---|
| @fastify/express @fastify/express | >= 4.0.5, < 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. The source does not state any other mitigations.
Fixed in: 4.0.10
Sources and references
- https://github.com/fastify/fastify-express/security/advisories/GHSA-662w-h4p6-jq4p — 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.