Security Digest · Vulnerability record

CVE-2026-33807: @fastify/express's middleware path doubling causes authentication bypass in child plugin scopes

@fastify/express v4.0.4 and earlier contains a path handling bug in the onRegister function that causes middleware paths to be doubled when inherited by child plugins.

CVSS 9.1 Critical EPSS 0.5% · p44

Should you act?

Critical and remotely reachable

No known exploitation yet, but it is network-reachable without credentials. This signal is computed from CISA KEV, EPSS and CVSS data; it is not an editorial verdict.

  • Not in CISA KEV, but CISA’s SSVC assessment records a public proof-of-concept, so attack code exists.
  • EPSS 0.5%, percentile 44: FIRST’s model estimates a 0.5% chance of exploitation activity in the next 30 days, higher than 44% of all scored CVEs (low). EPSS is a probability, not a verdict.
  • Remotely reachable with no login and no user interaction. If the vulnerable service is exposed to the internet, prioritize it.
  • Only applies if your dependency tree includes @fastify/express (npm) <= 4.0.4, fixed in 4.0.5. Check your lockfile, including transitive dependencies.

What it is

@fastify/express v4.0.4 and earlier contains a path handling bug in the onRegister function that causes middleware paths to be doubled when inherited by child plugins. When a child plugin is registered with a prefix that matches a middleware path, the middleware path is prefixed a second time, causing it to never match incoming requests. This results in complete bypass of Express middleware security controls, including authentication, authorization, and rate limiting, for all routes defined within affected child plugin scopes. No special configuration or request crafting is required. Upgrade to @fastify/express v4.0.5 or later.

From the GitHub advisory

Summary

@fastify/express v4.0.4 contains a path handling bug in the onRegister function that causes middleware paths to be doubled when inherited by child plugins. This results in complete bypass of Express middleware security controls for all routes defined within child plugin scopes that share a prefix with parent-scoped middleware. No special configuration is required — this affects the default Fastify configuration.

Details

The vulnerability exists in the onRegister function at index.js lines 92-101. When a child plugin is registered with a prefix, the onRegister hook copies middleware from the parent scope and re-registers it using instance.use(...middleware). However, the middleware paths stored in kMiddlewares are already prefixed from their original registration.

The call flow demonstrates the problem: 1. Parent scope registers middleware: app.use('/admin', authFn) — use() calculates path as '' + '/admin' = '/admin' — stores ['/admin', authFn] in kMiddlewares 2. Child plugin registers with { prefix: '/admin' } — triggers onRegister(instance) 3. onRegister copies parent middleware and calls instance.use('/admin', authFn) on child 4. Child's use() function calculates path as '/admin' + '/admin' = '/admin/admin' — registers middleware with doubled path 5. Routes in child scope use the child's Express instance, where middleware is registered under the incorrect path /admin/admin 6. Requests to /admin/secret don't match /admin/admin — middleware is silently skipped

Weakness type: CWE-436.

Product: @fastify/express (npm) · Assigned by: openjs · Published: 2026-04-15

Affected and fixed versions

EcosystemPackageVulnerableFirst fixed
npm@fastify/express<= 4.0.44.0.5
VendorProductAffected versions (per CVE record)
fastify@fastify/express< 4.0.5

Severity scores

Scored byCVSSScoreVector
openjs3.19.1 CriticalCVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:H/A:N
GitHub3.19.1 CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:H/A:N
  • Attack vector: network (remotely reachable)
  • Attack complexity: low
  • Privileges required: none (no login)
  • User interaction: none
  • Scope: unchanged

CVSS measures how bad a flaw is if exploited, not how likely exploitation is. Read it next to the exploitation data below.

Exploitation and urgency

  • CISA KEV: not listed (no confirmed in-the-wild exploitation known to CISA).
  • CISA SSVC assessment: exploitation poc, automatable yes, technical impact total.
  • FIRST EPSS (model of 2026-10-21): 0.53% probability of exploitation activity in the next 30 days; percentile 44.

Timeline

  • — CVE record last updated
  • — CVE record published by openjs
  • — GitHub-reviewed advisory GHSA-hrwm-hgmj-7p9c published (critical)

Sources and references

Original sources first. Version and fix details should always be confirmed against the vendor or project advisory.

Vulnerability records

  1. GitHub Advisory GHSA-hrwm-hgmj-7p9c github.com
  2. CVE.org record CVE-2026-33807 cve.org
  3. NVD entry CVE-2026-33807 nvd.nist.gov

Other references from the CVE record and advisory

  1. github.com github.com
  2. cna.openjsf.org cna.openjsf.org

Critical npm advisories · Today’s Security Digest