@fastify/http-proxy@11.6.8

proxy http requests, for Fastify

  • latest version

    11.6.10

  • latest non vulnerable version

  • first published

    4 years ago

  • latest version published

    4 days ago

  • licenses detected

  • Direct Vulnerabilities

    Known vulnerabilities in the @fastify/http-proxy 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
    • H
    Uncaught Exception

    @fastify/http-proxy is a proxy http requests, for Fastify

    Affected versions of this package are vulnerable to Uncaught Exception via the findUpstream method in the WebSocket proxy handler when websocket: true is enabled. A WebSocket upgrade request whose path carries a URL fragment (e.g. GET /echo#x) is matched by the router and answered with a 101 before the upstream link is created. Building the upstream target then throws, the error is only logged, and the accepted client socket is left open with no error listener. The next frame the client sends becomes an unhandled error event that terminates the Node.js process. A single unauthenticated upgrade request followed by one frame is sufficient to crash the server, and the request can be repeated to keep the process down.

    Note: This is only exploitable when the plugin is registered with websocket: true.

    How to fix Uncaught Exception?

    Upgrade @fastify/http-proxy to version 11.6.10 or higher.

    >=9.4.0 <11.6.10
    • H
    Uncaught Exception

    @fastify/http-proxy is a proxy http requests, for Fastify

    Affected versions of this package are vulnerable to Uncaught Exception via the handleUpgrade function when the plugin is registered with websocket: true. When an upgraded socket is dispatched through the Fastify router, Node.js removes its own error listener from the socket before emitting the upgrade event, and the plugin does not attach a replacement listener during routing. A socket error such as a client TCP reset (ECONNRESET) that arrives while an async hook is pending is therefore unhandled and terminates the Node.js process. A single unauthenticated upgrade request followed by a connection reset is sufficient to crash the server, and the request can be repeated to keep the process down.

    Note: This is only exploitable when websocket: true is used over a cleartext HTTP/1 listener. Upgrades over TLS are not affected because the TLSSocket retains its own error listener.

    How to fix Uncaught Exception?

    Upgrade @fastify/http-proxy to version 11.6.10 or higher.

    >=9.0.0 <11.6.10
    • M
    Missing Origin Validation in WebSockets

    @fastify/http-proxy is a proxy http requests, for Fastify

    Affected versions of this package are vulnerable to Missing Origin Validation in WebSockets via the default rewriteRequestHeaders implementation in the WebSocket proxy path, which forwards the client's Cookie header to the upstream but drops the browser's Origin header. Because the plugin never sets the ws origin option, upstream WebSocket servers that defend against cross-site hijacking by checking Origin receive no origin value and treat the connection as a trusted non-browser client, bypassing their origin check entirely. A malicious page visited by a logged-in user can open a WebSocket through the proxy to an upstream that authenticates with a cookie, and read or send messages on the user's behalf.

    Note: This is only exploitable when websocket: true is used with the default rewriteRequestHeaders (or a custom one that does not add Origin), in front of an upstream that relies on Origin and accepts a missing value, and when the browser attaches the cookie to the handshake (a SameSite=None cookie from any site, or any cookie from a same-site origin such as a sibling subdomain).

    How to fix Missing Origin Validation in WebSockets?

    Upgrade @fastify/http-proxy to version 11.6.10 or higher.

    >=7.1.0 <11.6.10
    • H
    Directory Traversal

    @fastify/http-proxy is a proxy http requests, for Fastify

    Affected versions of this package are vulnerable to Directory Traversal via validateDestination(), which rejects parent-directory path segments using an exact string match against ... A segment such as ..;, ..;jsessionid=x, or %2e%2e; is not equal to the plain .. form and passes the check undetected. The WHATWG URL parser treats such segments as ordinary path components, so the rewritePrefix containment check in resolveDestination() also passes. Servlet containers such as Apache Tomcat and Jetty strip semicolon path parameters from each segment before resolving dot-segments, so a request containing ..;-style segments is rewritten and reaches the upstream resolving above the intended subtree, escaping the path the proxy is meant to expose and, on some containers, crossing application contexts. Both the HTTP and WebSocket proxy paths are affected.

    Note: This is only exploitable when the upstream server treats ; as a path-parameter delimiter before resolving dot-segments (e.g. Apache Tomcat, Jetty). Node.js, nginx, Express, and Spring applications using StrictHttpFirewall are not affected.

    How to fix Directory Traversal?

    Upgrade @fastify/http-proxy to version 11.6.10 or higher.

    <11.6.10
    • H
    Uncaught Exception

    @fastify/http-proxy is a proxy http requests, for Fastify

    Affected versions of this package are vulnerable to Uncaught Exception via the shared WebSocket upgrade listener when websocket: true is enabled and a WebSocket upgrade is pipelined behind another HTTP request on the same cleartext connection. When the upgrade arrives while the prior request's response is still attached to the socket, the listener returns early without taking the upgrade and without attaching an error listener to the raw socket. Because Node.js removes its own error listener before emitting the upgrade event, a subsequent socket error on that connection - such as a client TCP reset (ECONNRESET) - is unhandled and terminates the Node.js process. An unauthenticated attacker can crash the server with a single pipelined connection and repeat the attack to keep the process down.

    Note: This is only exploitable over cleartext HTTP/1 listeners. Upgrades over TLS are not affected because TLSSocket retains its own error listener. On versions 9.0.0 to before 11.6.4, the pipelined upgrade alone (without a reset) terminates the process via an uncaught ERR_HTTP_SOCKET_ASSIGNED, and TLS connections are also affected on those versions.

    How to fix Uncaught Exception?

    Upgrade @fastify/http-proxy to version 11.6.10 or higher.

    >=9.0.0 <11.6.10