Vulnerability GHSA-p83c-4wj9-p6w9
Summary
http4s: Ember Server Accepts Duplicate Content-Length Headers
Details
Ember's HTTP/1.1 parser accepts a request that carries two Content-Length headers with differing values, accepting the latter value. RFC 9112 §6.3 requires a recipient to respond 400 (Bad Request) and close the connection.
When an Ember server is deployed behind a intermediary that frames on a different occurrence of the header, HTTP request smuggling (CL.CL desync) is possible.
Impact
Server
The server is vulnerable to HTTP request smuggling when deployed as an origin behind an intermediary that maintains keep-alive connections and frames requests using a different Content-Length value than Ember, which uses a last-wins policy.
- Front-end security bypass: the smuggled request reaches paths the intermediary might have blocked, with attacker-chosen method and headers.
- Cross-user request hijack: a dangling smuggled prefix concatenates with the next victim's request on the shared backend socket, capturing its sensitive headers (e.g.,
CookieorAuthorization). - Cache poisoning: the smuggled response is associated with the next request key in a caching proxy.
Client
The same parser is used by the client and applies to the response path. The threat is narrower and less severe than the server:
- The upstream server (origin or intermediary) must be malicious or compromised.
- The client must be deployed as a proxy shared across multiple downstream consumers. If the misframed bytes are attached to a different downstream user's request on a pooled connection, cross-user response hijack or cache poisoning are possible.
Preconditions
- Any
EmberServerBuilderHTTP/1.1 config behind an intermediary - Unauthenticated remote attacker able to reach the intermediary
- That intermediary forwards at least two differing
Content-Lengthheaders without rejecting and frames on a different occurrence of the header - Intermediary keeps persistent upstream connections
Patches
The issue is addressed in http4s-0.23.35.
Workarounds
- Use a strictly-conformant intermediary that rejects differing
Content-Lengthwith400
Resources
Related Vulnerabilities
Other vulnerabilities affecting the same packages