@fastify/reply-from@12.8.2

forward your HTTP request to another server, for fastify

  • latest version

    12.9.2

  • latest non vulnerable version

  • first published

    4 years ago

  • latest version published

    9 days ago

  • licenses detected

  • Direct Vulnerabilities

    Known vulnerabilities in the @fastify/reply-from package. This does not include vulnerabilities belonging to this package’s dependencies.

    Fix vulnerabilities automatically

    Snyk's AI Trust Platform automatically finds the best upgrade path and integrates with your development workflows. Secure your code at zero cost.

    Fix for free
    VulnerabilityVulnerable Version
    • C
    HTTP Request Smuggling

    @fastify/reply-from is a forward your HTTP request to another server, for fastify

    Affected versions of this package are vulnerable to HTTP Request Smuggling via the handleDest function in index.js, which forwards the client's Content-Length header to the upstream server even when no body is written. This occurs for GET, HEAD, or TRACE requests that carry a body (which Fastify does not read), and for JSON bodies that parse to a falsy value (null, 0, false, or ""), where a truthiness check causes the body to be silently dropped. The upstream server then waits for bytes that never arrive and reads the next request on the keep-alive connection as the tail of the previous body, allowing an unauthenticated attacker to desynchronize the connection, smuggle arbitrary HTTP requests past the proxy's routes, hooks, and authentication, reach upstream-only endpoints, and exhaust the upstream connection pool.

    Note: This is only exploitable when using the core Node.js http transport (the http option, undici: false, or any release before 5.0.0 where it was the default); the default undici transport and the HTTP/2 path are not affected.

    How to fix HTTP Request Smuggling?

    Upgrade @fastify/reply-from to version 12.9.1 or higher.

    <12.9.1
    • H
    Directory Traversal

    @fastify/reply-from is a forward your HTTP request to another server, for fastify

    Affected versions of this package are vulnerable to Directory Traversal via the buildURL function, which validates dot-segments on the raw attacker-supplied source string but not on the path the WHATWG URL parser actually resolves. When source begins with the same special scheme as the base (e.g. http: or https:), the URL parser drops the scheme and treats the remainder as a relative path, so a payload such as http:%2e%2e%2fsecret.txt passes the dot-segment check (the inspected segment reads as http:.. rather than ..) while the proxy forwards %2e%2e%2fsecret.txt upstream unchanged. An upstream that percent-decodes the request path before resolving dot-segments then serves a resource outside the configured prefix, allowing an unauthenticated client to escape the intended prefix and reach sibling or parent upstream endpoints.

    How to fix Directory Traversal?

    Upgrade @fastify/reply-from to version 12.8.4 or higher.

    >=12.8.1 <12.8.4
    • H
    Directory Traversal

    @fastify/reply-from is a forward your HTTP request to another server, for fastify

    Affected versions of this package are vulnerable to Directory Traversal via the buildURL function, which validates path segments against .. using an exact string match. A segment carrying a semicolon path parameter, such as ..;, ..;jsessionid=x, or %2e%2e;, is not equal to the plain .. form and passes the traversal check. The WHATWG URL parser keeps such a segment as an ordinary path segment, so the base-prefix containment check also passes and the segment is forwarded to the upstream unchanged. Backends that strip semicolon path parameters before resolving dot-segments, including Apache Tomcat, Jetty, WildFly, and Spring Boot, normalize ..; back into .., allowing an unauthenticated client to escape the intended upstream prefix and reach internal paths such as admin or internal API endpoints, including via state-changing HTTP methods.

    Note: This is only exploitable when the upstream is a Java servlet container (e.g. Apache Tomcat, Jetty, WildFly, Spring Boot) that treats ; as a path-parameter delimiter; deployments proxying to Node.js, nginx, or Express upstreams are not affected.

    How to fix Directory Traversal?

    Upgrade @fastify/reply-from to version 12.8.4 or higher.

    <12.8.4