HTTP Request SmugglingAffected versions of this package are vulnerable to HTTP Request Smuggling via fixRequestBody in src/handlers/fix-request-body.ts, which uses req.readableLength === 0 as proof that a body parser has consumed the request body, when that same value is observed before any body byte has arrived. A remote unauthenticated attacker can send request headers first, wait one event-loop turn, and then send a body containing a complete second HTTP/1.1 request. When a body-parser 1.x parser has declined the declared media type, it assigns a truthy req.body without consuming the stream; fixRequestBody then serializes that empty body, rewrites the upstream Content-Length to zero, and writes it before the still-live request stream is piped upstream. The backend consumes the synthesized zero-length body and parses the attacker's withheld bytes as a second request on the persistent connection, bypassing the gateway's route filter, explicit path denials, and trusted-header normalization, and on a pooled upstream connection an attacker-controlled following request can receive the smuggled response.
Note: This is only exploitable when a body-parser 1.x parser runs before the proxy and declines the request media type (leaving a truthy req.body and an unread stream), fixRequestBody is registered as on.proxyReq, the request body arrives after the headers in a later event-loop turn, and the upstream connection remains persistent (the default from 4.0.0-beta.2; on 2.x, 3.x, and 4.0.0-beta.0 a pooling agent or an explicit client Connection: keep-alive header is required).
How to fix HTTP Request Smuggling? Upgrade org.mvnpm:http-proxy-middleware to version 3.0.3, 4.2.1 or higher.
| [2.0.9,3.0.3)[3.0.5,4.2.1) |
Uncaught ExceptionAffected versions of this package are vulnerable to Uncaught Exception via the handleUpgrade function when ws: true is enabled. An Upgrade request whose path does not match pathFilter leaves the raw socket without an error listener, so a remote unauthenticated client can send such an Upgrade request and then reset the TCP connection, triggering an unhandled ECONNRESET error that terminates the gateway process. This crash occurs even when middleware and server error and clientError callbacks are configured.
How to fix Uncaught Exception? A fix was pushed into the master branch but not yet published.
| |
Partial String ComparisonAffected versions of this package are vulnerable to Partial String Comparison via the router component. An attacker can route requests to unintended backend servers by sending crafted HTTP requests with manipulated Host headers.
How to fix Partial String Comparison? Upgrade org.mvnpm:http-proxy-middleware to version 2.0.10, 3.0.7, 4.1.0 or higher.
| [1.3.1,2.0.10)[3.0.3,3.0.7)[4.0.0,4.1.0) |
CRLF InjectionAffected versions of this package are vulnerable to CRLF Injection via the fixRequestBody function. An attacker can inject or override multipart form fields, potentially bypassing gateway-side validation or access controls, by supplying crafted input containing carriage return and line feed characters in field names or values. This can result in the backend receiving manipulated parameters not visible to the gateway, enabling unauthorized actions or parameter tampering.
Note:
This is only exploitable if the proxy application uses a non-multipart parser to populate the request body, the outgoing request is sent as multipart/form-data, and the application calls fixRequestBody with attacker-controlled input.
How to fix CRLF Injection? Upgrade org.mvnpm:http-proxy-middleware to version 3.0.7, 4.1.1 or higher.
| [3.0.4,3.0.7)[4.0.0,4.1.1) |