Summary
In @fastify/express versions 4.0.0 through 4.0.9, path-scoped Express middleware can be silently skipped inside a prefixed plugin. The vendor fixed the issue in version 4.0.10.
What happened
@fastify/express is a compatibility layer that lets Express middleware run inside Fastify. In versions 4.0.0 through 4.0.9, the plugin joins the mount path of a path-scoped middleware to the Fastify plugin prefix by string concatenation. If the prefix ends with a slash or the mount path omits its leading slash, the resulting Express mount path does not line up with the route served by the Fastify router. Express fails to match and passes the request on, while the Fastify router still dispatches the route, so the middleware is silently skipped. According to the source, no crafted request and no non-default option is required, and string, array, and regular-expression mount paths are all affected. The associated weaknesses are CWE-436 and CWE-863.
Why it matters
An application that uses path-scoped Express middleware for authentication or authorization inside a prefixed plugin can expose protected routes to unauthenticated clients. The CVSS 3.1 score is 9.1 (critical severity), with vector CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:H/A:N, assigned by CNA:openjs. CISA's KEV catalog does not list this vulnerability as actively exploited, and the source does not describe it as a zero-day.
Affected products and versions
@fastify/express, versions >= 4.0.0 and < 4.0.10 (affected). Version 4.0.10 is listed as unaffected.
| Product | Versions | Fixed in |
|---|---|---|
| @fastify/express @fastify/express | >= 4.0.0, < 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 is in advisory GHSA-f44m-4qwg-5587 (https://github.com/fastify/fastify-express/security/advisories/GHSA-f44m-4qwg-5587) and at https://cna.openjsf.org/security-advisories.html.
Fixed in: 4.0.10
Sources and references
- https://github.com/fastify/fastify-express/security/advisories/GHSA-f44m-4qwg-5587 — CVE Program
- https://cna.openjsf.org/security-advisories.html — CVE Program
Weaknesses (CWE): CWE-436, CWE-863
Relevant change history
Advisory correction
The preliminary version was replaced by the full write-up.
Published
Preliminary advisory published.