Fastify Middie Middleware Path Bypass
CVE-2026-22031GHSA-cxrg-g7r8-w69p
What to do
Vendor fix available. Upgrade each affected package to the fixed version on its release line (@fastify/middie 9.1.0), redeploy, then verify what is actually installed.
This page has no inventory attached, so it cannot say whether you are affected. A vendor fix is not proof that your deployment is fixed.
Affected packages
npm @fastify/middie
- Affected
- <= 9.0.3
- Fixed in
- 9.1.0
Sources
- Open Source Vulnerabilities (OSV.dev), including the GitHub Advisory Database
OSV record GHSA-cxrg-g7r8-w69p lists affected ranges: npm @fastify/middie >=0 <9.1.0 (fixed)
VerifiedObserved Structured OSV record; GitHub-reviewed advisory.
- GitHub Advisory Database and maintainer security advisories on GitHub
GitHub-reviewed advisory GHSA-cxrg-g7r8-w69p lists affected ranges: npm @fastify/middie >=0 <=9.0.3
VerifiedObserved Structured GitHub Advisory Database record (type=reviewed) from the GitHub REST API.
Severity and exploitation
- Exploitation
- No confirmed exploitation recorded. Patch Next marks exploitation only from CISA KEV.
- CVSS
- 8.4 · CVSS:3.1/AV:N/AC:H/PR:L/UI:N/S:C/C:H/I:H/A:L
- EPSS
- CVE-2026-22031: 0.53% estimated exploitation activity in the next 30 days; percentile 45.03 (FIRST EPSS, 2026-11-03). This is a model estimate, not proof of exploitation or customer exposure.
Source description
As published by the source; long descriptions are shortened.
Summary A security vulnerability exists in @fastify/middie where middleware registered with a specific path prefix can be bypassed using URL-encoded characters (e.g., /%61dmin instead of /admin). While the middleware engine fails to match the encoded path and skips execution, the underlying Fastify router correctly decodes the path and matches the route handler, allowing attackers to access protected endpoints without the middleware constraints. Details The vulnerability is caused by how middie matches requests against registered middleware paths. 1. Regex Generation: When fastify.use('/admin', ...) is called, middie uses path-to-regexp to generate a regular expression for the path /admin. 2. Request Matching: For every request, middie executes this regular expression against req.url (or req.originalUrl). 3. The Flaw: req.url in Fastify contains the raw, undecoded path string. The generated regex expects a decoded path (e.g., /admin). If a request is sent to /%61dmin, the regex…
Dates and revisions
- Published by the source
- Last modified by the source
- Source last checked
- Revision 2 · amended ·
Amended from ghsa record GHSA-cxrg-g7r8-w69p
- Revision 1 · created ·
Published from osv record GHSA-cxrg-g7r8-w69p
Agent brief
Preview the exact text before you copy it. Commands are read-only suggestions; review them before running anything.
# Patch Next advisory brief: CVE-2026-22031 Advisory: Fastify Middie Middleware Path Bypass IDs: CVE-2026-22031, GHSA-cxrg-g7r8-w69p Record: https://patchnext.com/advisories/cve-2026-22031 (revision 2, source checked 26 Oct 2026, 12:41 UTC) Inventory: none attached. This brief comes from a public page and does not say whether any deployment is affected. Severity: High (CVSS 8.4) Exploitation: no confirmed exploitation recorded. Patch Next confirms exploitation only from CISA KEV. Vendor response: Vendor fix available; fixed versions by package: @fastify/middie 9.1.0. A vendor fix does not mean a deployment is fixed. ## Affected components - npm @fastify/middie: affected <= 9.0.3; fixed in 9.1.0 ## Suggested inspection (read-only) - `npm ls @fastify/middie --all`: lists every installed copy and version, including transitive ones. Run in the project root after `npm ci`. ## Supported action Upgrade each affected component to a fixed version on its release line. For a transitive dependency, upgrade the parent package or add an override or constraint, then regenerate the lockfile. Redeploy every environment that ran an affected version. ## Required regression checks - Run the test suite and a production build. - Exercise the features that depend on @fastify/middie. - Repeat the inspection and confirm that only fixed versions remain installed. ## Rollback considerations - Keep the previous lockfile and deployment artifact. Rolling back reinstates the vulnerable version, so apply any documented mitigation while you fix forward. ## Unresolved questions - Which deployments run an affected version? - Exploitation status can change. Check again before lowering the priority. - Mark the work resolved only after the fixed version is verified in production. ## Sources - Verified: https://osv.dev/vulnerability/GHSA-cxrg-g7r8-w69p (OSV record GHSA-cxrg-g7r8-w69p lists affected ranges: npm @fastify/middie >=0 <9.1.0 (fixed)) - Verified: https://github.com/advisories/GHSA-cxrg-g7r8-w69p (GitHub-reviewed advisory GHSA-cxrg-g7r8-w69p lists affected ranges: npm @fastify/middie >=0 <=9.0.3) Commands are suggestions: review each one before running it.
Loading voting…