CVE Professor
/
All CVEs
CVE-2026-135279

CVE-2026-135279 — @fastify/express (4.0.14) — CWE-287 · CWE-436

CRITICAL CVSS 9.1 NVD+CVE.org

@fastify/express is the plugin that lets an application run Express middleware and Express applications inside the Fastify web framework. In versions before 4.0.14, a request with an empty dynamic route parameter reaches a Fastify route handler while middleware mounted for that path inside an Express Router or sub-application is skipped, because Fastify's router accepts an empty value where Express requires a non-empty one, and an unanchored regular-expression mount passed to the plugin is bypassed the same way. An earlier fix covered only the mount paths passed to the plugin directly, not middleware mounted inside a routed Express application. An attacker can use this to bypass authentication or other middleware-based access controls on the affected routes, with the practical impact depending on what the empty value selects in the application. The issue is fixed in @fastify/express 4.0.14, and users should upgrade to 4.0.14 or later. As a workaround, enforce authentication in a Fastify hook such as preHandler that runs after routing, mount the middleware on a static parent path, or require non-empty values in the route params schema.

@fastify/express is the plugin that lets an application run Express middleware and Express applications inside the Fastify web framework. In versions before 4.0.14, a request with an empty dynamic route parameter reaches a Fastify route handler while middleware mounted for that path inside an Express Router or sub-application is skipped, because Fastify's router accepts an empty value where Express requires a non-empty one, and an unanchored regular-expression mount passed to the plugin is bypassed the same way. An earlier fix covered only the mount paths passed to the plugin directly, not middleware mounted inside a routed Express application. An attacker can use this to bypass authentication or other middleware-based access controls on the affected routes, with the practical impact depending on what the empty value selects in the application. The issue is fixed in @fastify/express 4.0.14, and users should upgrade to 4.0.14 or later. As a workaround, enforce authentication in a Fastify hook such as preHandler that runs after routing, mount the middleware on a static parent path, or require non-empty values in the route params schema.

CVSS v3.1 Vector Metrics
CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:H/A:N
Attack Vector Network AV:N
Attack Complexity Low AC:L
Privileges Req. None PR:N
User Interaction None UI:N
Scope Unchanged S:U
Confidentiality High C:H
Integrity High I:H
Availability None A:N
AI Security Analysis & Remediation

CVE‑2026‑135279 – Fastify‑Express Plugin Route‑Parameter Bypass


🎯 What is this vulnerability?

ItemDetail
Component@fastify/express plugin (versions < 4.0.14)
Vulnerable functionThe bridge that forwards an incoming Fastify request to an embedded Express router/sub‑application.
Root causeCWE‑287: Improper Authentication – the plugin relies on the *Fastify* router to decide whether a request matches a route before invoking the *Express* middleware stack. Fastify’s router treats a dynamic route parameter (/:id) as a match even when the captured value is an empty string (""). Express, by contrast, does not consider an empty segment a match for a dynamic parameter. The plugin therefore skips the Express middleware (often authentication, ACL, CSRF checks, etc.) when the request URL contains an empty value for a parameter that the Fastify route expects. <br><br>CWE‑436: Interpretation Conflict – the mismatch in path‑matching semantics between Fastify and Express creates an interpretation conflict that the bridge fails to reconcile. The plugin only normalised mount‑paths supplied directly to it; it did not normalise paths that are later added inside an Express router or sub‑application, leaving the conflict exploitable.

Technical flow of the flaw

1. Fastify registers a route, e.g. fastify.get('/api/users/:userId', handler).
2. Inside the Fastify handler the plugin mounts an Express router:

fastify.register(require('@fastify/express')).after(() => {
     const router = require('express').Router();
     router.use(authMiddleware);               // <‑‑ authentication
     router.get('/profile', (req, res) => { … });
     fastify.use('/api/users/:userId', router);
   });

3. A request arrives at /api/users//profile (note the double slash → empty userId).
4. Fastify’s router matches the path because it only checks that a segment exists; the captured userId value is the empty string.
5. The plugin forwards the request to the Express router without re‑evaluating the empty segment. Express treats the empty segment as non‑matching for :userId, so the request is considered to be targeting the mounted base path (/api/users/) without any further sub‑path. Consequently the Express router’s middleware stack (including authMiddleware) is never executed and the request is handed directly to the Fastify handler (or to a downstream Fastify route that may be less protected).

The result is a bypass of any middleware‑based access control that lives inside the Express router/sub‑application for routes that contain a dynamic parameter.


⚡ Attack Chain

1. Discovery & Reconnaissance

StepTechniqueExpected Artefacts
a. Identify Fastify usageScan public HTTP headers, error pages, or JavaScript bundles for strings like fastify, @fastify/express, or fastify-express (e.g., X-Powered-By: Fastify).Header X-Powered-By: Fastify or stack traces in 404/500 pages.
b. Fingerprint plugin versionQuery the package.json via exposed source‑code repositories (GitHub, GitLab) or by requesting /package.json if the server mistakenly serves it. Look for "@fastify/express": "4.0.x" or earlier."@fastify/express": "4.0.12" → vulnerable.
c. Locate dynamic‑parameter routesUse automated crawling (e.g., ffuf, dirsearch) with patterns that include double slashes (//) or empty segments to see if the server returns a *different* response (e.g., a protected page becomes accessible).Response code 200 with content that normally requires authentication when the request contains //.

2. Exploitation

Note: The exact endpoint (/api/users/:userId/profile) is an illustrative example. The attack works on any Fastify route that contains a dynamic segment and mounts an Express router/sub‑app under that route.

Goal: Reach a protected Express endpoint while skipping its authentication middleware.

PoC (cURL)

# Illustrative target: protected profile endpoint
# Normal request (requires auth):
#   GET /api/users/123/profile   → 401 Unauthorized
# Exploit request (empty param):
#   GET /api/users//profile      → 200 OK (auth bypass)

curl -i -s "http://victim.example.com/api/users//profile"

Explanation of the request

PartWhy it matters
// between users and profileProduces an *empty* value for the :userId dynamic segment. Fastify matches the route, Express does not, so the Express middleware stack is never entered.
No authentication headersBecause the middleware that would reject the request is bypassed, the request succeeds without a token or cookie.

If the application uses a static parent mount (e.g., fastify.use('/api/users', router) without a dynamic segment), the bypass does not occur. The vulnerability is limited to dynamic‑parameter mounts.

3. Post‑exploitation

ImpactHow it is achieved
Confidentiality breachAccess to user‑specific data (/profile, /settings, etc.) without a valid session token.
Privilege escalationIf the Express router implements role‑based checks after authentication (e.g., if (req.user.isAdmin) …), the attacker can reach admin‑only endpoints by supplying an empty parameter that maps to a privileged Fastify handler.
Data manipulationPOST/PUT/PATCH endpoints behind the same router can be invoked to modify resources (e.g., change email, password) without authentication.
Further lateral movementOnce inside, the attacker may retrieve internal API keys, configuration files, or use the compromised account to pivot to other services that trust the Fastify application.

Because the vulnerability does not provide remote code execution, the impact stops at confidentiality and integrity (as reflected by the CVSS vector C:H/I:H/A:N).


🌍 Real‑World Impact

CIA TriadCVSS Vector Interpretation
Confidentiality (C:H)An unauthenticated attacker can read sensitive data that should be protected by Express‑level authentication (e.g., personal profiles, financial records).
Integrity (I:H)The attacker can modify or delete resources that are normally protected, leading to data tampering.
Availability (A:N)No denial‑of‑service effect is directly caused by the flaw; the service remains available.

Practical consequences

  • SaaS platforms that expose user‑specific APIs via Fastify + Express may leak personal data.
  • Internal admin panels built on this stack could be accessed without credentials, allowing configuration changes.
  • Compliance regimes (PCI‑DSS, GDPR) could be violated because authentication controls are effectively bypassed.
  • Given the network‑reachable, low‑complexity, unauthenticated nature of the exploit (AV:N/AC:L/PR:N/UI:N), an attacker can weaponise this vulnerability at scale with automated scanners.


    🛡️ Remediation & Mitigation

    1. Patch

    ActionDetails
    UpgradeMove to @fastify/express ≥ 4.0.14. The fix normalises both direct mount paths and paths added later inside an Express router, rejecting empty dynamic parameters before routing to Express.
    Version rangeAll versions < 4.0.14 are vulnerable. The latest stable release (as of the CVE publication date) is the recommended target.
    TestAfter upgrade, run integration tests that include requests with empty segments (//) and verify that the Express middleware is still invoked (expect 401/403).

    2. Immediate Work‑arounds (if patch cannot be applied)

    TechniqueImplementation
    Fastify pre‑handler hookEnforce authentication *after* Fastify routing, before any Express router is invoked. Example:
    fastify.addHook('preHandler', async (request, reply) => {
      // Simple token check – runs for every matched Fastify route
      if (!request.headers.authorization) {
        reply.code(401).send({ error: 'Missing auth' });
      }
    });
    Static parent mountMount the Express router on a static path (no : parameters) and perform any parameter validation inside Fastify handlers. Example: fastify.use('/api/users', router);
    Schema validation for paramsDefine a Fastify schema that rejects empty strings for the dynamic segment.
    fastify.route({
      method: 'GET',
      url: '/api/users/:userId/profile',
      schema: {
        params: {
          type: 'object',
          properties: {
            userId: { type: 'string', minLength: 1 }
          },
          required: ['userId']
        }
      },
      handler: …
    });

    | Express‑side guard | Add a catch‑all middleware at the top of every Express router that verifies the captured param is non‑empty. |

    router.use((req, res, next) => {
      if (req.params && Object.values(req.params).some(v => v === '')) {
        return res.status(400).send('Invalid route parameter');
      }
      next();
    });

    3. Detection

    IndicatorLog pattern / SIEM rule
    Fastify route hit with empty paramGET /api/users//profile → status 200 (or any non‑error) where a 401/403 is expected.
    Express middleware not executedAbsence of log entries that the authentication middleware normally writes (e.g., Auth check passed for user …). Correlate with the same request URL containing //.
    Unexpected token usageRequests that contain an Authorization header and an empty dynamic segment – may indicate probing.
    WAF rule (ModSecurity example)
    SecRule REQUEST_URI "@rx \/[^\/]+\/\/" \
      "id:1000010,phase:2,deny,log,msg:'Fastify‑Express empty‑param bypass attempt',tag:'application-multi',tag:'fastify',severity:2"

    ⚠️ Urgency

  • CVSS 9.1 (Critical) – high impact, low complexity, remote, unauthenticated.
  • No CISA KEV listing – the vulnerability is not yet in the public “Known Exploited Vulnerabilities” catalog, but the attack vector is trivial enough that exploits are likely to appear quickly.
  • Exploitability – a single crafted request (//) is sufficient; no prior authentication or user interaction is required.
Patch priority: Critical. Deploy the upgrade to @fastify/[email protected] (or later) immediately on any production system that mounts Express routers under Fastify routes containing dynamic parameters. Apply the work‑arounds above as interim controls if a rolling upgrade is not feasible.
Bottom line: The mismatch between Fastify’s permissive empty‑segment matching and Express’s stricter semantics creates an authentication bypass that can be triggered with a single extra slash. Because the bypass is unauthenticated, network‑accessible, and leads to full read/write of protected resources, remediation must be treated as a top‑priority emergency fix.

[🤖 CVE Professor AI Security Engine]

Target Reconnaissance Queries (FOFA & Shodan)

FOFA Query

app="@fastify/express @fastify/express"
CVSS Score
9.1 / 10 · CVSS CRITICAL
Weakness Types (CWE)
CWE-287 CWE-436
Affected Products (1)
@fastify/express:@fastify/express (4.0.14)
References & Advisories (2)
Related CVEs
9.8
CVE-2026-145051
WWBN AVideo before 29.9.0 contains an authentication bypass vulnerability in the LoginWordPress plugin that al
9.6
CVE-2026-145025
Grav API plugin before 1.1.21 validates the client-supplied admin_base_url or Origin header with PHP parse_url
9.3
CVE-2026-47677
FacturaScripts is an open source accounting and invoicing software. Prior to version 2026.3, there is an authe
8.7
CVE-2026-120762
Improper authorization in the push-publish bundle receiver (user import handler) in dotCMS versions before 26.
8.6
CVE-2026-144962
Nginx UI from 2.4.1 before 2.9.2 contains a directive denylist bypass in internal/config/validation.go that al
8.2
CVE-2026-145366
### Summary A URI SAN is a context-specific, primitive GeneralName with tag number 6 (identifier octet `0x86`
8.1
CVE-2026-145022
ZITADEL from 4.0.0 before 4.20.5 contains an MFA bypass vulnerability in Login V2 that allows attackers knowin