CVE-2026-22037: CWE-177: Improper Handling of URL Encoding (Hex Encoding) in fastify fastify-express
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.
AI Analysis
Technical Summary
The vulnerability CVE-2026-22037 affects the @fastify/express plugin, which integrates Express middleware compatibility into the Fastify web framework. The core issue lies in how the plugin matches incoming request paths against registered middleware paths. Specifically, when a middleware is registered with a path prefix (e.g., /admin), the plugin’s matching logic does not properly decode URL-encoded characters in the request path before matching. For example, an attacker can request /%61dmin (where %61 is the ASCII hex code for 'a'), which the middleware matching logic fails to recognize as /admin, causing it to skip middleware execution. However, the underlying Fastify router correctly decodes the path and matches the route handler for /admin, allowing the request to reach protected endpoints without passing through the middleware that enforces security controls such as authentication or authorization. This discrepancy creates a bypass scenario where middleware protections are circumvented. The vulnerability is classified under CWE-177 (Improper Handling of URL Encoding) and CWE-288 (Authentication Bypass Using an Alternate Path). It affects all versions of @fastify/express prior to 4.0.3, which contains the fix. The CVSS v3.1 score is 8.4 (High), reflecting network attack vector, low privileges required, no user interaction, and a scope change with high confidentiality and integrity impact and low availability impact. No public exploits are known yet, but the vulnerability’s nature makes it a serious risk for web applications relying on this plugin for middleware enforcement.
Potential Impact
For European organizations, this vulnerability poses a significant risk to web applications built with Fastify and the @fastify/express plugin. Attackers can bypass critical middleware protections such as authentication, authorization, logging, or input validation by exploiting URL-encoded path bypasses. This can lead to unauthorized data access, privilege escalation, and potential data breaches impacting confidentiality and integrity of sensitive information. The availability impact is low but could increase if attackers leverage this access to deploy further exploits. Organizations in sectors with stringent data protection requirements (e.g., finance, healthcare, government) face regulatory and reputational risks if exploited. The vulnerability’s network attack vector and no user interaction requirement mean it can be exploited remotely and at scale, increasing the threat surface. Given the widespread use of Node.js and Fastify in European tech ecosystems, especially in countries with advanced digital infrastructure, the impact can be substantial without timely mitigation.
Mitigation Recommendations
1. Upgrade all instances of @fastify/express to version 4.0.3 or later immediately to apply the official patch addressing the URL encoding bypass. 2. Conduct a thorough audit of middleware path registrations to identify any sensitive routes protected by middleware that could be bypassed via encoded paths. 3. Implement additional request validation or normalization layers before middleware matching to decode and sanitize URL paths, ensuring consistent matching behavior. 4. Employ Web Application Firewalls (WAFs) with rules to detect and block suspicious URL-encoded requests targeting sensitive endpoints. 5. Monitor application logs for unusual access patterns involving encoded URLs that could indicate exploitation attempts. 6. Educate development teams about secure middleware configuration and the risks of relying solely on path-based middleware protections. 7. Consider defense-in-depth by enforcing authentication and authorization checks within route handlers themselves, not only in middleware. 8. Regularly update dependencies and monitor vulnerability disclosures related to Fastify and its plugins.
Affected Countries
Germany, United Kingdom, France, Netherlands, Sweden, Ireland
CVE-2026-22037: CWE-177: Improper Handling of URL Encoding (Hex Encoding) in fastify fastify-express
Description
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.
AI-Powered Analysis
Technical Analysis
The vulnerability CVE-2026-22037 affects the @fastify/express plugin, which integrates Express middleware compatibility into the Fastify web framework. The core issue lies in how the plugin matches incoming request paths against registered middleware paths. Specifically, when a middleware is registered with a path prefix (e.g., /admin), the plugin’s matching logic does not properly decode URL-encoded characters in the request path before matching. For example, an attacker can request /%61dmin (where %61 is the ASCII hex code for 'a'), which the middleware matching logic fails to recognize as /admin, causing it to skip middleware execution. However, the underlying Fastify router correctly decodes the path and matches the route handler for /admin, allowing the request to reach protected endpoints without passing through the middleware that enforces security controls such as authentication or authorization. This discrepancy creates a bypass scenario where middleware protections are circumvented. The vulnerability is classified under CWE-177 (Improper Handling of URL Encoding) and CWE-288 (Authentication Bypass Using an Alternate Path). It affects all versions of @fastify/express prior to 4.0.3, which contains the fix. The CVSS v3.1 score is 8.4 (High), reflecting network attack vector, low privileges required, no user interaction, and a scope change with high confidentiality and integrity impact and low availability impact. No public exploits are known yet, but the vulnerability’s nature makes it a serious risk for web applications relying on this plugin for middleware enforcement.
Potential Impact
For European organizations, this vulnerability poses a significant risk to web applications built with Fastify and the @fastify/express plugin. Attackers can bypass critical middleware protections such as authentication, authorization, logging, or input validation by exploiting URL-encoded path bypasses. This can lead to unauthorized data access, privilege escalation, and potential data breaches impacting confidentiality and integrity of sensitive information. The availability impact is low but could increase if attackers leverage this access to deploy further exploits. Organizations in sectors with stringent data protection requirements (e.g., finance, healthcare, government) face regulatory and reputational risks if exploited. The vulnerability’s network attack vector and no user interaction requirement mean it can be exploited remotely and at scale, increasing the threat surface. Given the widespread use of Node.js and Fastify in European tech ecosystems, especially in countries with advanced digital infrastructure, the impact can be substantial without timely mitigation.
Mitigation Recommendations
1. Upgrade all instances of @fastify/express to version 4.0.3 or later immediately to apply the official patch addressing the URL encoding bypass. 2. Conduct a thorough audit of middleware path registrations to identify any sensitive routes protected by middleware that could be bypassed via encoded paths. 3. Implement additional request validation or normalization layers before middleware matching to decode and sanitize URL paths, ensuring consistent matching behavior. 4. Employ Web Application Firewalls (WAFs) with rules to detect and block suspicious URL-encoded requests targeting sensitive endpoints. 5. Monitor application logs for unusual access patterns involving encoded URLs that could indicate exploitation attempts. 6. Educate development teams about secure middleware configuration and the risks of relying solely on path-based middleware protections. 7. Consider defense-in-depth by enforcing authentication and authorization checks within route handlers themselves, not only in middleware. 8. Regularly update dependencies and monitor vulnerability disclosures related to Fastify and its plugins.
Affected Countries
Technical Details
- Data Version
- 5.2
- Assigner Short Name
- GitHub_M
- Date Reserved
- 2026-01-05T22:30:38.719Z
- Cvss Version
- 3.1
- State
- PUBLISHED
Threat ID: 696e7feca027839b3dc0118d
Added to database: 1/19/2026, 7:03:08 PM
Last enriched: 1/26/2026, 7:47:58 PM
Last updated: 2/7/2026, 2:05:23 AM
Views: 103
Community Reviews
0 reviewsCrowdsource mitigation strategies, share intel context, and vote on the most helpful responses. Sign in to add your voice and help keep defenders ahead.
Want to contribute mitigation steps or threat intel context? Sign in or create an account to join the community discussion.
Related Threats
CVE-2026-2071: Buffer Overflow in UTT 进取 520W
HighCVE-2026-25762: CWE-400: Uncontrolled Resource Consumption in adonisjs core
HighCVE-2026-25754: CWE-1321: Improperly Controlled Modification of Object Prototype Attributes ('Prototype Pollution') in adonisjs core
HighCVE-2026-25644: CWE-295: Improper Certificate Validation in datahub-project datahub
HighCVE-2026-25804: CWE-287: Improper Authentication in antrea-io antrea
HighActions
Updates to AI analysis require Pro Console access. Upgrade inside Console → Billing.
Need more coverage?
Upgrade to Pro Console in Console -> Billing for AI refresh and higher limits.
For incident response and remediation, OffSeq services can help resolve threats faster.