Summary
In affected @fastify/reply-from versions, a forwarded request can retain the client's Content-Length header even though the plugin sends no request body upstream. On a reused connection, an upstream server may interpret bytes from the next request as the missing body, allowing request smuggling and connection desynchronization.
Affected context
The issue occurs in request forwarding when the plugin omits a body but forwards the incoming Content-Length header. This can happen with body-bearing GET, HEAD, or TRACE requests, or with a falsy JSON body. Risk depends on the upstream server's parsing behavior and whether the connection is reused for subsequent requests.
Exploit preconditions
- Attack surface: An application uses @fastify/reply-from to proxy requests to an upstream server.
- Required access: The attacker can send requests to the application; additional access may be required by the application's own authentication and routing controls.
- Trigger point: The plugin forwards a request without its body while retaining the client's Content-Length header.
- Why exploitation is possible: The upstream may treat bytes from a subsequent request on the same connection as the unfinished body, causing the proxy and upstream to disagree about request boundaries.
Why this happens
The proxy forwards framing metadata that does not match the request bytes it sends. When Content-Length describes a body that is absent, the upstream can parse the shared connection differently from the proxy. This is an HTTP message interpretation inconsistency covered by CWE-444: Inconsistent Interpretation of HTTP Requests.
Potential impact
- An attacker may smuggle a request to the upstream server.
- Subsequent requests could be misattributed or processed under an unintended context.
- Depending on the deployment, this could enable access-control bypass, cache poisoning, or exposure of data.
General mitigation guidance
Defensive patterns focus on keeping forwarded HTTP framing consistent with the bytes actually sent.
- Remove or recompute Content-Length and related framing headers based on the forwarded body.
- Use proxy behavior that safely handles requests with absent or unsupported bodies.
- Prefer well-maintained HTTP forwarding components with secure-by-default framing behavior.
- Reduce trust in client-supplied hop-by-hop and message-framing headers.
- Limit upstream connection reuse where safe framing cannot be guaranteed, and apply least privilege to proxy and upstream access.
How teams detect issues like this
- Review proxy code for forwarding Content-Length or Transfer-Encoding independently of the body that is actually written.
- Use static analysis and code review checks to identify mismatches between request-body handling and forwarded framing headers.
- Test proxy and upstream parsing behavior with requests that have body-related headers but no forwarded body, including on reused connections.
- Enforce policies that reject ambiguous or inconsistent HTTP framing at ingress and proxy boundaries.
- Monitor for anomalous request boundaries, unexpected upstream request counts, or parsing errors.

