HIGH 7.5

CVE-2026-14181: @fastify/middie Denial of Service via Malformed URL Encoding

A vulnerability in @fastify/middie versions 9.1.0 through 9.3.2 allows an attacker to crash Node.js applications by sending HTTP requests with malformed URL encodings. When the middleware attempts to normalize incoming request paths containing broken percent-encoded sequences—such as incomplete escape codes or truncated multibyte characters—the underlying decoder throws an unhandled exception that terminates the entire process. This causes immediate service unavailability for all connected users until the application restarts. The vulnerability only affects applications using middie's standalone engine API; those using the Fastify plugin integration are protected because Fastify's error handler catches the exception before it propagates.

Source data · NVD / CISA · public domain

CVSS
3.1 · 7.5 HIGH · CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:N/I:N/A:H
Weaknesses (CWE)
CWE-248
Affected products
1 configuration(s)
Published / Modified
2026-07-01 / 2026-07-02

NVD description (verbatim)

@fastify/middie versions 9.1.0 through 9.3.2 fail to guard the URL normalization step used by the standalone engine when incoming request paths contain malformed percent-encoded sequences. Inputs such as an incomplete percent escape or a truncated multibyte sequence cause the underlying decoder to throw synchronously, and the exception escapes the middie normalize step and terminates the Node.js process. The bypass affects applications that call middie.run directly on the standalone engine API, causing an immediate denial of service for all connected clients until restart. Applications using the Fastify plugin path are not affected because Fastifys error handler catches the exception. Patches: upgrade to @fastify/middie 9.3.3. Workarounds: migrate from the standalone engine API to the Fastify plugin path, where the framework error handler catches the exception.

2 reference(s) · View on NVD →

SEC.co analysis · AI-assisted, reviewed against source

Technical summary

The vulnerability exists in @fastify/middie's URL normalization logic within the standalone engine implementation. When processing incoming request paths, the normalization step invokes a URL decoder on untrusted input without proper exception handling. Malformed percent-encoded sequences—including incomplete escapes (e.g., '%') and truncated UTF-8 multibyte sequences—cause the decoder to throw a synchronous exception. Because the standalone API lacks the exception handling layer provided by the Fastify framework, this unhandled exception propagates up the call stack and terminates the Node.js process. The vulnerability is classified as CWE-248 (uncaught exception), reflecting the failure to guard against or gracefully handle decoder errors. Applications calling middie.run() directly on the standalone engine are vulnerable; those instantiating middie as a Fastify plugin benefit from the framework's top-level error handlers.

Business impact

Organizations relying on @fastify/middie via the standalone engine face a critical availability risk. A single malicious or malformed HTTP request can instantly take down an application server, disrupting all active sessions and services until manual restart. In production environments without robust process management or load balancer failover, this can result in significant downtime. The attack requires no authentication or special privileges—any network-adjacent or Internet-facing instance is exposed. Applications processing user-supplied URLs or handling edge cases in URL encoding are at heightened risk. Dependent services and microservices relying on affected instances may experience cascading failures.

Affected systems

@fastify/middie versions 9.1.0 through 9.3.2 are vulnerable. The vulnerability applies only to applications using the standalone engine API (middie.run() called directly outside the Fastify plugin context). Applications deployed via the Fastify plugin path—the recommended and more common integration pattern—are unaffected because the Fastify framework's error handling layer intercepts the exception. Users should verify their integration method: if middie is registered as middleware within a Fastify application instance, no remediation is required. If the standalone API is in use, immediate patching to version 9.3.3 or higher is necessary.

Exploitability

Exploitability is trivial. An attacker can send a single HTTP request with a malformed URL-encoded payload to trigger a denial of service. The attack requires no authentication, no user interaction, and no special conditions beyond network access to the application. The CVSS 3.1 score of 7.5 (HIGH) reflects the network-accessible attack vector (AV:N), low attack complexity (AC:L), no privilege requirement (PR:N), and high availability impact (A:H). The attack is reliable and reproducible; examples of triggering payloads include incomplete percent escapes in the path or query string. However, the attack is limited to denial of service—there is no confidentiality or integrity impact, and the attacker cannot execute arbitrary code or access data.

Remediation

The definitive fix is to upgrade @fastify/middie to version 9.3.3 or later. This patch version introduces proper exception handling around the URL normalization step, ensuring that malformed percent-encoded sequences are handled gracefully without terminating the process. For organizations unable to patch immediately, migration to the Fastify plugin integration pattern provides protection; refactoring the application to use middie as a registered plugin within a Fastify app instance allows the framework's error handlers to catch and manage the exception. This workaround may require architectural changes depending on how the standalone API is currently integrated. Testing should confirm that URL decoding errors no longer crash the application and that requests with malformed encoding are handled per the application's error policy.

Patch guidance

Upgrade @fastify/middie to version 9.3.3 or higher via your package manager (e.g., npm update @fastify/middie or yarn upgrade @fastify/middie). After patching, restart affected application instances to ensure the new code is loaded. Verify the patch version in your lock file or dependencies list. If you are using the standalone API, test with known malformed URL payloads (e.g., requests with '%' or truncated UTF-8 sequences in the path) to confirm the application no longer crashes. If adopting the Fastify plugin pattern as a workaround instead, thoroughly test the refactored integration in a staging environment and update your application documentation to reflect the new middleware registration method.

Detection guidance

Monitor application logs and process exit events for unexpected crashes or service restarts correlated with HTTP requests containing unusual URL encodings. Look for error messages or stack traces indicating failures during URL decoding or path normalization within middie. Analyze access logs for requests with incomplete percent escapes (%, %7 without a second hex digit) or non-standard multibyte sequences. Network-level detection tools can flag HTTP requests with malformed percent-encoding in the path or query string as potential exploit attempts. Set up alerting for sudden process terminations in Node.js applications running vulnerable versions of @fastify/middie. After patching, baseline behavior should show these requests handled gracefully (e.g., returning an error response) rather than crashing the server.

Why prioritize this

This vulnerability should be prioritized for immediate patching if you use @fastify/middie's standalone engine API. The combination of effortless exploitability, high availability impact, and widespread deployments of Fastify-based applications creates significant operational risk. Organizations running microservices architectures or containerized deployments where rapid restart masks the issue may face cascading failures or silent service degradation. The fix is straightforward and low-risk, making remediation a priority. Conversely, if your application uses only the Fastify plugin integration, this vulnerability is not actionable and can be deprioritized.

Risk score, explained

The CVSS 3.1 score of 7.5 (HIGH) appropriately captures the risk: the attack is trivial (AV:N, AC:L, PR:N, UI:N) and results in complete service unavailability (A:H), but does not enable data exfiltration or system compromise (C:N, I:N). The scope is unchanged (S:U)—the impact is confined to the affected service. The HIGH severity reflects that denial of service is a serious operational impact. However, the score does not account for context: organizations with robust process orchestration, load balancers, or failover mechanisms may tolerate brief downtime, while those without such protections face acute operational risk. Adjust prioritization based on your deployment model and tolerance for availability loss.

Frequently asked questions

Does this affect applications using Fastify plugins?

No. Only applications calling middie.run() directly on the standalone engine are vulnerable. If middie is registered as middleware within a Fastify application instance (the typical and recommended pattern), Fastify's error handler catches the exception and prevents process termination. You can verify your integration by checking whether middie is instantiated as a Fastify plugin (fastify.register()) or used as a standalone module.

What types of URLs trigger this vulnerability?

Any HTTP request with a malformed percent-encoded sequence in the path or query string can trigger the crash. Examples include incomplete escapes (%, %2 without a second hex digit), non-UTF-8 multibyte sequences, or other decoder-incompatible encodings. You do not need to craft a semantically valid URL; the normalization step fails during decoding, before the URL is interpreted.

Is there a temporary fix if I cannot patch immediately?

Yes. If you are using the standalone API, migrate to the Fastify plugin integration pattern. Register middie as middleware within your Fastify application instance using fastify.register(). This allows Fastify's error handler to catch and manage decoding exceptions. This workaround requires refactoring but provides protection equivalent to patching while you plan your upgrade.

Can an attacker execute code or steal data via this vulnerability?

No. The vulnerability is limited to denial of service. The malformed URL causes the decoder to throw an exception, which crashes the process—there is no code execution, data exfiltration, or integrity impact. An attacker can disrupt availability but cannot gain unauthorized access or compromise data.

This analysis is derived from the official CVE record published on 2026-07-01. Version numbers, patch guidance, and affected ranges should be verified against the @fastify/middie release notes and security advisories. CVSS scores and CWE classifications are as reported by the vulnerability database. Organizations should conduct internal testing to confirm patch applicability and compatibility with their specific deployment configurations. This vulnerability explainer is provided for informational purposes to support risk assessment and remediation planning; it does not constitute legal advice or a guarantee of security. Source: NVD (public-domain), retrieved 2026-08-10. Analysis generated by SEC.co (claude-haiku-4-5).