@fastify/express auth bypass via empty dynamic segment (CVE-2026-124626)

A path-scoped Express middleware bypass in @fastify/express 4.0.5 through 4.0.9 can let unauthenticated requests reach protected handlers. Fixed in 4.0.10.

Summary

CVE-2026-124626 affects @fastify/express versions 4.0.5 through 4.0.9. The plugin's matcher for path-scoped Express middleware requires a non-empty dynamic segment, while Fastify's router accepts an empty parameter or wildcard value. This mismatch can cause a request with an empty segment to match a Fastify route and run the handler while the scoped Express middleware is skipped. No special configuration is required. The practical impact depends on what the empty value selects in the application, but it can allow an unauthenticated request to reach a protected handler.

What to do

1. Upgrade @fastify/express to 4.0.10 or later immediately. 2. Review the vendor advisory and NVD entry for additional guidance: https://github.com/fastify/fastify-express/security/advisories/GHSA-662w-h4p6-jq4p and https://nvd.nist.gov/vuln/detail/CVE-2026-124626 3. Audit applications using scoped Express middleware mounts with dynamic path segments to identify routes that may have been exposed. 4. Check access logs for requests with empty dynamic segments hitting protected routes. 5. If you cannot upgrade right away, verify with the vendor advisory before applying any workaround, and consider adding explicit authentication/authorization checks at the Fastify route level.

References

- NVD: https://nvd.nist.gov/vuln/detail/CVE-2026-124626 - GitHub Advisory: https://github.com/fastify/fastify-express/security/advisories/GHSA-662w-h4p6-jq4p - OpenJS Foundation security advisories: https://cna.openjsf.org/security-advisories.html

Sources