/

CVE-2026-129504

Severity:

CRITICAL RISK

(9.1)

Authorization Bypass (CWE-863) in @fastify/express

CVE-2026-129504

Awaiting Analysis

Vulnerability type

Category:

Authorization Bypass

CWE:

CWE-436, CWE-863

Impact:

Unauthorized access to protected routes

Severity:

CRITICAL RISK

(9.1)

CVSS version:

3.1

Catch this CVE while code is being written

Detect vulnerable code directly in pull requests, so CVEs are fixed before merge.

Summary

A path-matching mismatch in @fastify/express can cause path-scoped Express middleware to be skipped when used inside a prefixed Fastify plugin. If that middleware provides authentication or authorization, an unauthenticated request may reach a protected route without those checks.

Affected context

The issue affects applications using @fastify/express versions 4.0.0 through 4.0.9 where path-scoped Express middleware is registered inside a Fastify plugin with a prefix. Certain combinations of a trailing slash in the plugin prefix or a missing leading slash in the middleware mount path can make Express and Fastify interpret the route differently. String, array, and regular-expression mount paths are affected.

Exploit preconditions

  • Attack surface: HTTP routes served by a Fastify application using @fastify/express
  • Required access: No prior access is required when the affected route is publicly reachable
  • Trigger point: A normal request to a route in a prefixed plugin where path-scoped middleware is expected to run
  • Why exploitation is possible: A path-joining mismatch can prevent Express middleware from matching, while Fastify still dispatches the route

Why this happens

The plugin constructs a path-scoped middleware mount path by concatenating it with the Fastify plugin prefix. Under affected path combinations, Express and Fastify interpret the resulting paths inconsistently, allowing the router to dispatch a request after the middleware has failed to match. This behavior can lead to CWE-863: Incorrect Authorization when the skipped middleware enforces access control, and reflects a broader interpretation conflict described by CWE-436.

Potential impact

  • Unauthenticated users may reach routes intended to require authentication
  • Authorization checks implemented in the skipped middleware could be bypassed
  • Sensitive data or operations exposed by affected routes could be accessed or invoked

General mitigation guidance

Defensive approaches focus on keeping middleware and router path interpretation aligned:

  • Use path-joining and normalization behavior that consistently handles leading and trailing slashes
  • Prefer secure-by-default routing and middleware registration patterns that fail closed when a match is uncertain
  • Apply authentication and authorization at a layer that cannot be bypassed by middleware path mismatches
  • Minimize reliance on user-controlled or otherwise untrusted values when constructing route and mount paths
  • Limit route privileges and access to sensitive operations according to least-privilege principles

How teams detect issues like this

  • Review middleware registration in prefixed plugins for path concatenation and slash-normalization assumptions
  • Test that every protected route invokes its expected authentication and authorization middleware across path variants
  • Use static analysis or code review checks to flag middleware paths assembled through ad hoc string concatenation
  • Enforce policies requiring explicit access-control coverage for sensitive routes
  • Add integration tests that verify requests are denied when authentication or authorization middleware should apply

Sources

SourceLink
cna.openjsf.orgcna.openjsf.org/security-advisories.html
github.comgithub.com/fastify/fastify-express/security/advisories/GHSA-f44m-4qwg-5587

Frequently asked

questions

It may be exploitable through ordinary HTTP requests when an affected application exposes a route whose path-scoped access-control middleware is skipped.

No prior access may be needed if the affected route is publicly reachable. The key condition is that the application uses the affected middleware and plugin path configuration.

Ensure middleware mount paths and router prefixes are normalized and interpreted consistently, and enforce access control at a layer that fails closed.

Test access-control coverage across route and prefix variations, avoid ad hoc path concatenation, and use code review and static checks to identify inconsistent routing behavior.

Find out what's already
exploitable in your codebase.