Skip to main content
Menu
Advisories

@fastify/reply-from vulnerable to path traversal via semicolon path-parameter dot-segments

GHSA-6MPH-MJG3-F943Published Updated GitHub

Description

Impact

@fastify/reply-from's buildURL() rejects .. path segments by exact string match, so a segment such as ..;, ..;jsessionid=x, or %2e%2e; is not equal to .. and passes the traversal check. The WHATWG URL parser keeps it as an ordinary segment, so the base-prefix containment check also passes and the segment is forwarded to the upstream unchanged. An application that scopes proxying to an upstream prefix can have an unauthenticated request escape that prefix.

Backends that strip ; path parameters before resolving dot-segments (Apache Tomcat, Jetty, WildFly, Spring Boot) turn ..; back into .., reaching upstream paths the proxy was meant to hide such as internal APIs or admin endpoints; non-GET methods are forwarded too, so state-changing endpoints are reachable. Verified against Apache Tomcat 9.0.123. Exploitation requires an upstream that treats ; as a path-parameter delimiter (a Java servlet container); deployments proxying to Node.js, nginx, or Express upstreams are not affected.

Patches

Upgrade to @fastify/reply-from 12.8.4. buildURL() now strips ; parameters from each decoded path segment before the traversal check, rejecting ..;-style traversal while leaving the forwarded path and legitimate matrix parameters unchanged.

Workarounds

Reject requests whose decoded path contains a ; in front of the proxy (for example in an onRequest hook), or configure the servlet upstream to reject path parameters.

Affected versions

References

GitHub · fastify/fastify-reply-from