Summary
fast-uri may decode percent-encoded hostname data more than once while parsing and recomposing a URI. When an application normalizes or resolves an untrusted HTTP-family URI before routing, redirect validation, or host-policy enforcement, the final destination may differ from the originally represented host, enabling server-side request forgery or policy bypass.
Affected context
The issue occurs in fast-uri versions whose hostname parsing and authority recomposition perform repeated percent-decoding. It becomes risky when an application accepts untrusted URIs and uses fast-uri normalization or resolution before making outbound requests, validating redirects, or applying allowlists and network-boundary policies. The affected release ranges include 2.4.1 through versions before 2.4.5, 3.1.2 through versions before 3.1.6, and 4.0.0 through versions before 4.1.3.
Exploit preconditions
- Attack surface: An application-facing URI parser or resolver used for outbound HTTP-family requests
- Required access: Ability to supply or influence a URI processed by the application
- Trigger point: Hostname decoding during URI normalization, resolution, or authority recomposition
- Why exploitation is possible: The parser may decode nested percent escapes more than once, causing the effective destination to differ from the value evaluated by validation or policy logic
Why this happens
The vulnerability is caused by repeated decoding of percent-encoded hostname data during separate parsing and recomposition stages. RFC 3986 requires percent-encoded data to be decoded only when the resulting representation is used and prohibits decoding the same string more than once. This behavior maps primarily to CWE-174: Improper Handling of Additional Special Characters in Output, because a second decoding pass changes the semantic meaning of previously encoded data. It also enables CWE-918: Server-Side Request Forgery when the resulting host is used for server-side network access.
Potential impact
- An attacker may redirect server-side requests to unintended internal or loopback destinations
- Host allowlists or deny lists could be bypassed
- Applications could expose services reachable from the request-making environment
- Redirect validation may approve a URI whose final destination differs after resolution
- Network segmentation assumptions could be weakened
General mitigation guidance
Mitigation typically focuses on ensuring that URI percent escapes are decoded at most once and that validation evaluates the same canonical representation used for outbound routing.
Common defensive patterns include:
- Use a parser implementation that preserves encoded percent signs and performs a single, standards-compliant decoding pass
- Canonicalize the host before validation, then route only to the validated canonical destination
- Apply host, scheme, port, DNS, and IP-range policies after normalization and before connection establishment
- Treat redirects and user-controlled URI components as untrusted at every processing stage
- Restrict outbound network privileges and apply egress controls to reduce the impact of SSRF
- Avoid relying solely on textual hostname checks when DNS resolution or alternate address representations may change the destination
How teams detect issues like this
Organizations can detect this class of issue through:
- Static analysis and dependency review rules for URI parsing libraries with repeated decode or recomposition paths
- Code review checks for normalization performed separately from host-policy validation
- Tests using nested percent-encoded URI components to verify that parsing does not change the effective destination unexpectedly
- Policy checks requiring canonical host validation immediately before outbound connection creation
- Integration monitoring for requests from application services to loopback, link-local, metadata, or otherwise restricted address ranges
- Automated software composition analysis and security review tools that identify vulnerable dependency ranges

