Summary
In affected @fastify/reply-from versions, backslash-based dot segments can bypass path validation and be normalized by the URL parser into a different upstream path. When an application relies on the proxy to restrict access to an upstream prefix, an unauthenticated request may reach unintended upstream endpoints, primarily risking confidentiality.
Affected context
The issue occurs in applications using @fastify/reply-from to forward requests to an upstream HTTP server when proxy paths are intended to be limited to a specific prefix. It becomes risky when path validation checks forward-slash dot segments but URL construction later normalizes backslashes or their percent-encoded form for supported schemes. Applications that rely on route guards before forwarding may also be affected if those guards do not account for the normalized destination.
Exploit preconditions
- Attack surface: An application endpoint that forwards requests through @fastify/reply-from
- Required access: The described scenario can involve unauthenticated requests; the proxy endpoint must be reachable
- Trigger point: Request path validation and subsequent construction of the upstream URL
- Why exploitation is possible: Backslash-based dot segments can evade validation and then be normalized into path traversal by the URL parser, potentially escaping the intended upstream prefix
Why this happens
The path validation and URL construction stages interpret path separators differently. Validation checks forward-slash dot segments, while the WHATWG URL parser normalizes backslashes and encoded backslashes for relevant schemes. This mismatch allows a path to pass the check but resolve to a different upstream location, mapping to CWE-22: Improper Limitation of a Pathname to a Restricted Directory.
Potential impact
- Requests may reach upstream endpoints outside the intended prefix.
- Sensitive upstream resources may be disclosed.
- Limited integrity impact may occur if unintended endpoints allow state-changing operations.
General mitigation guidance
Prefer a vendor-fixed release and ensure paths are canonicalized and validated before constructing the destination URL. Reject dot segments, control characters, and ambiguous whitespace after normalization, and use allowlisted upstream paths or destinations where practical. Avoid relying solely on route guards that may evaluate a different path representation, and limit the proxy's upstream permissions to the resources it needs.
How teams detect issues like this
Review proxy path validation and URL construction for differences in separator and encoding normalization. Static analysis and code review can look for validation performed before canonicalization, especially when paths are subsequently passed to URL parsers. Test that policy enforcement applies to the final normalized destination, and consider CI checks that reject ambiguous path forms in proxy-routing code.

