Jul 21, 2026·8 min read·3 visits
A difference in backslash parsing between fast-uri (RFC 3986) and Node.js fetch (WHATWG) allows attackers to bypass URL host checks and perform SSRF.
An interpretation conflict (CWE-436) exists in fast-uri due to differing handling of backslash characters between RFC 3986 and the WHATWG URL specification. This differential allows remote attackers to bypass SSRF filters and origin-allowlist protections when fast-uri is used in conjunction with WHATWG-compliant HTTP clients like Node.js native fetch or undici.
The fast-uri library is a popular, highly-optimized URI parsing package in the Node.js ecosystem, frequently utilized in performance-sensitive routing, validation, and proxying workflows. Modern API gateways, reverse proxies, and web applications adopt this library to perform rapid input validation before relaying incoming network requests downstream. The attack surface of this component resides in its exposure to untrusted user input, typically through query parameters, webhook registration interfaces, or redirect redirect_uri parameters.
This technical analysis explores an interpretation conflict vulnerability classified under CWE-436. The flaw exposes downstream applications to host validation bypasses, open redirects, and Server-Side Request Forgery (SSRF) when mixed parsing architectures are employed. When validating inputs with fast-uri and sending requests with a WHATWG-compliant client, attackers can manipulate delimiters to route requests to unauthorized destinations.
The fundamental cause of CVE-2026-16221 is an incompatibility between two distinct parsing standards: RFC 3986 and the WHATWG URL Specification. The fast-uri library strictly enforces the RFC 3986 standard, under which a literal backslash (\) is treated as a standard character and is not recognized as an authority or path delimiter. In contrast, modern WHATWG-compliant URL engines (such as those embedded in modern browsers, Node.js fetch(), and the undici HTTP client) incorporate error recovery rules that automatically normalize a backslash into a forward slash (/) when processing "special schemes" like http or https.
To trigger the vulnerability, an attacker constructs a URL containing a literal backslash within the authority portion of the URI, such as http://evil.com\@allowed.com. The RFC 3986 parser inside fast-uri identifies the @ symbol as the delimiter between user information and the host, treating evil.com\ as the username and allowed.com as the target hostname. However, the downstream WHATWG consumer normalizes the backslash to a forward slash before parsing, producing http://evil.com/@allowed.com. In this normalized structure, evil.com becomes the target host, and the remaining portion (/@allowed.com) is shifted into the path component of the request.
This division of parsing logic results in security desynchronization. When a system relies on fast-uri to validate whether a destination host belongs to a trusted domain, the validation check succeeds because fast-uri reports the safe host (allowed.com). When the same unmodified URL is forwarded to the native HTTP client, the client establishes a connection with the malicious host (evil.com). This mismatch completely neutralizes the protection offered by any domain allowlist, allowing unrestricted outbound requests.
The vulnerability was addressed across multiple major branches of fast-uri by implementing an explicit validation check within the authority parsing routine. In vulnerable versions, the library evaluated the input string directly using a regular expression pattern that failed to inspect the authority block for non-compliant literal backslashes. The fix introduces a secondary regular expression, AUTHORITY_PREFIX, designed specifically to extract the authority substring prior to evaluating the primary URI pattern.
// Patched logic in index.js
const AUTHORITY_PREFIX = /^(?:[^#/:?]+:)?\/\/([^/?#]*)/
function parseWithStatus (uri, opts) {
// ... initialization ...
// A literal backslash (U+005C) is not a valid RFC 3986 URI character and is
// not an authority delimiter. Reject it in the authority rather than
// rewriting it: normalizing "\\" -> "/" (WHATWG error recovery) could silently
// change the resource identified by an otherwise-invalid input, and lets "\\"
// act as a host delimiter here while Node's native URL parses a different
// host (SSRF / redirect / origin-allowlist bypass). Percent-encoded %5C is
// untouched and remains valid encoded data.
const authorityMatch = uri.match(AUTHORITY_PREFIX)
if (authorityMatch !== null && authorityMatch[1].indexOf('\\') !== -1) {
parsed.error = 'URI authority must not contain a literal backslash.'
malformedAuthorityOrPort = true
}
const matches = uri.match(URI_PARSE)
// ... secondary parsing logic ...
}The maintainers deliberately decided to reject any input containing a literal backslash in the authority rather than normalizing it to a forward slash. Rejection is the most secure remedy because normalization would silently alter the resource mapping, potentially introducing secondary injection vectors or unexpected path modifications. By explicitly raising a validation error and setting parsed.error, the library ensures that any ambiguous URL is flagged as malformed, preventing downstream execution. This design choice completely blocks the host-confusion attack surface without breaking RFC 3986 compliance for standard percent-encoded characters like %5C.
Exploitation of CVE-2026-16221 requires an architecture where validation and HTTP request execution are performed by different parsing engines. An attacker must first locate an endpoint that accepts a user-controlled URL, subjects it to a domain-based filter using fast-uri, and subsequently fetches the content of that URL via a WHATWG-compliant client like Node's native fetch or the undici library. No pre-existing authentication is required to execute this attack, provided the target endpoint is publicly accessible.
An attacker seeking to execute a Server-Side Request Forgery (SSRF) attack against an internal cloud metadata service can supply the payload http://169.254.169.254\\@trusted.example.com. The internal verification flow using fast-uri extracts the host as trusted.example.com and allows the request. During the execution phase, Node's fetch normalizes the URL to http://169.254.169.254/@trusted.example.com, causing the client to connect directly to the link-local metadata address and return sensitive AWS instance credentials to the attacker.
This same exploitation mechanism can be applied to bypass open redirect protections in OAuth flows. An attacker can construct a redirect URI such as https://attacker.com\\@legit-auth.com/oauth/callback. The authentication server validates the redirect target against an origin allowlist using fast-uri, which incorrectly matches the host as the legitimate auth service. When the client browser or downstream backend handles the redirect, the backslash normalizes to a forward slash, redirecting the user's browser session and authorization code to the attacker's server.
The security consequences of this interpretation conflict are highly critical, particularly for enterprise architectures deploying internal microservices. If an attacker successfully bypasses the host-validation layer, they can interface directly with internal systems that lack authentication, such as databases, administration consoles, and orchestration endpoints. This unauthorized access can lead to remote code execution (RCE) on internal nodes, data exfiltration, or complete system compromise depending on the exposed services.
In cloud environments, the impact is further amplified by the accessibility of metadata endpoints. By accessing the link-local address 169.254.169.254, attackers can harvest temporary identity credentials, IAM security tokens, and configuration data, facilitating complete tenant takeover. The vulnerability holds a CVSS v3.1 base score of 7.5, with high impact to integrity because the attacker can actively redirect the destination of network requests.
While the EPSS score of 0.00221 suggests a low probability of immediate exploitation in generic environments, the actual threat in specific deployments using mixed-specification parsers is substantial. There are no documented instances of this CVE being leveraged in active ransomware campaigns, nor is it currently listed on CISA's Known Exploited Vulnerabilities catalog. However, due to the ease of constructing the payload and the prevalence of Node.js-based microservices, organizations should treat this vulnerability as a high-priority risk.
The primary and recommended mitigation for CVE-2026-16221 is to upgrade the fast-uri library to the patched releases. Dependents using the v4.x release line must update to fast-uri@4.1.1 or higher, those on the v3.x line must upgrade to 3.1.4 or higher, and legacy applications utilizing v2.x must update to 2.4.3. These updates contain the regression-tested validation checks that properly flag authority backslashes as malformed inputs.
When direct package upgrades are blocked by strict dependency freezes or complex legacy builds, security teams can implement an input-filtering workaround. Developers can introduce a verification step that rejects any input URL where the authority component contains a literal backslash prior to performing validation. This pre-filter effectively neutralizes the host-confusion vector by preemptively blocking any ambiguous delimiters before they reach fast-uri:
function secureValidate(inputUrl) {
const authorityPart = inputUrl.split(/[?#]/)[0];
if (authorityPart.includes('\\')) {
throw new Error('Invalid URL: Backslash detected in authority');
}
return fastUri.parse(inputUrl);
}A more robust defense-in-depth approach involves aligning the validation and request execution phases to use the exact same parsing engine. By standardizing on Node's native URL class for both validation logic and subsequent fetch calls, the risk of interpretation conflicts is completely eliminated. Developers should also review their dependency trees for indirect inclusions of fast-uri through third-party web frameworks and enforce resolution updates at the lockfile level.
CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:N/I:H/A:N| Product | Affected Versions | Fixed Version |
|---|---|---|
fast-uri fastify | >= 2.3.1, < 2.4.3 | 2.4.3 |
fast-uri fastify | >= 3.0.0, < 3.1.4 | 3.1.4 |
fast-uri fastify | >= 4.0.0, < 4.1.1 | 4.1.1 |
| Attribute | Detail |
|---|---|
| CWE ID | CWE-436 (Interpretation Conflict) |
| Attack Vector | Network (Unauthenticated) |
| CVSS v3.1 Score | 7.5 (High) |
| EPSS Score | 0.00221 (Percentile: 12.73%) |
| Impact | Bypass of Security Policies / Host-Validation Controls |
| Exploit Status | Proof of Concept (PoC) documented in official advisory |
| KEV Status | Not Listed |
The product receives input and passes it to multiple components, but the components interpret the input differently, leading to inconsistent states or insecure actions.
A Denial of Service (DoS) vulnerability has been identified in the Node.js XML parsing library fast-xml-parser. The flaw allows unauthenticated remote attackers to cause severe CPU exhaustion, event-loop blocking, and system crashes by sending a crafted XML payload containing repeated DOCTYPE declarations that bypass recursive entity expansion protections.
The high-performance Node.js image processing library sharp inherits several high and medium-severity security vulnerabilities from its underlying native dependency libvips. These include integer overflows in dimensions calculation, heap-based buffer overflows in GIF/TIFF and JPEG2000 processing, and out-of-bounds reads in the EXIF directory decoder, enabling denial of service and potential code execution.
An authorization bypass vulnerability exists in FasterXML jackson-databind versions 2.18.x up to 2.18.8 (and other release branches) where the active @JsonView constraint is bypassed during the deserialization of properties marked with @JsonUnwrapped. This allows remote, authenticated attackers to alter restricted administrative properties on server-side objects by injecting flattened parameters into standard JSON payloads.
CVE-2026-58426 is a critical security vulnerability in Gitea Actions where improper signature serialization allows an authenticated attacker to execute a canonicalization (boundary-shifting) attack. By rewriting query parameters while keeping the signature intact, the attacker can bypass access control checks to read private workflow artifacts or modify concurrent task upload states.
GitPython prior to version 3.1.51 contains a command injection vulnerability due to flaws in its option validation routine. By exploiting Git's native argument parser behavior, specifically long-option abbreviation resolution and short-option clustering, attackers can bypass the check_unsafe_options blocklist to execute arbitrary OS commands.
CVE-2026-59879 describes a critical integer overflow vulnerability in the Immutable.js library when handling indices near 32-bit boundaries. An attacker can leverage this flaw to cause a denial of service via CPU thread lockup or process crashes, as well as data corruption through silent size truncation.