Summary
Erlang OTP's inets httpd module mishandles HTTP requests containing duplicate Content-Length headers, leading to HTTP Request Smuggling.
When deployed behind common reverse proxies, an attacker can desynchronize the front-end and back-end HTTP streams, allowing hidden requests, cache poisoning, and credential hijacking under certain traffic patterns.
Affected context
This vulnerability arises when Erlang OTP's inets httpd server is used:
- As an origin server behind a reverse proxy or load balancer (e.g., nginx, Apache httpd, Envoy)
- Over HTTP/1.1 where message framing relies on
Content-Lengthheaders - Without an intermediary that normalizes or rejects malformed headers, including duplicates
The risk materializes in deployments where the proxy and inets httpd interpret duplicate Content-Length headers differently, causing them to disagree about request boundaries.
Exploit preconditions
- Attack surface: HTTP/1.1 interfaces exposed directly or via a reverse proxy to untrusted clients (e.g., internet-facing APIs or web endpoints).
- Required access: Ability to send crafted HTTP requests to the front-end proxy that are forwarded to an inets
httpdbackend. - Trigger point: A request with multiple
Content-Lengthheaders where: - The proxy honors the last
Content-Lengthvalue. - The inets backend honors the earliest
Content-Lengthvalue. - Why exploitation is possible: The backend (
httpd_request:parse_headers/7) does not reject or normalize duplicateContent-Lengthheaders and violates RFC 9112 Section 6.3. This causes the proxy and backend to parse the request body length differently, leaving attacker-controlled bytes queued to be interpreted as the start of a subsequent request.
Why this happens
The core issue is inconsistent handling of duplicate Content-Length headers between the inets httpd server and common reverse proxies. Inets:
- Accepts requests with multiple
Content-Lengthheaders instead of rejecting them as invalid. - Uses the earliest
Content-Lengthvalue for body parsing, while forward proxies typically use the last value.
This diverging interpretation breaks the assumption that all HTTP intermediaries agree on message boundaries, enabling HTTP Request Smuggling. Abstractly, this maps to CWE-444: Inconsistent Interpretation of HTTP Requests, where two or more HTTP components process the same request differently due to non-compliant parsing and missing normalization of ambiguous or malformed headers.
Potential impact
- Smuggling of hidden HTTP requests through the proxy to the inets backend
- Hijacking or piggybacking on other users' connections by injecting requests into their session
- Cache poisoning or cache deception at the proxy layer, potentially serving attacker-controlled responses to other clients
- Bypassing authentication, routing, or WAF rules enforced only at the proxy
- Leveraging desynchronized request streams as a stepping stone to exploit additional backend vulnerabilities
General mitigation guidance
Effective mitigations focus on normalizing HTTP message framing and enforcing strict parsing rules across the stack:
- Ensure HTTP servers and proxies reject any request with multiple
Content-Lengthheaders or any ambiguous combination ofContent-LengthandTransfer-Encoding. - Prefer standard-compliant behavior that treats malformed framing as a hard error, closing the connection rather than attempting to guess intent.
- Introduce a normalization layer at the edge (e.g., a hardened proxy or gateway) that:
- Canonicalizes headers.
- Drops or blocks requests with duplicate or conflicting framing headers.
- Apply a "single source of truth" policy for request framing: configure components so that only one mechanism (
Content-Lengthor chunkedTransfer-Encoding) is accepted at a time. - Segment and lock down internal HTTP paths so that high-value endpoints are not directly reachable from general-purpose front-ends.
- Use least privilege for backend applications so that any smuggled requests have minimized reach and effect.
How teams detect issues like this
Detection typically combines protocol-aware analysis, code review, and behavioral monitoring:
- Static/code review:
- Examine HTTP parsing logic (e.g.,
httpd_request:parse_headers/7) for: - Acceptance of duplicate
Content-Lengthheaders. - Non-compliant handling of conflicting
Content-Length/Transfer-Encoding. - Use static analysis or linting rules that flag ambiguous header parsing and lack of normalization.
- Configuration review:
- Inspect reverse proxy and gateway configurations for:
- Explicit rules rejecting malformed framing.
- Consistent parsing policies across all entry points.
- Dynamic testing:
- Employ HTTP Request Smuggling test suites in staging (e.g., fuzzers or DAST tools) to send crafted requests with multiple
Content-Lengthheaders and observe: - Response timing anomalies.
- Evidence of desynchronization (e.g., responses that combine content from multiple logical requests).
- Runtime monitoring:
- Log and alert on:
- Requests containing duplicate
Content-Lengthor conflicting framing headers. - Unusual 4xx/5xx patterns or misaligned request/response pairs that may indicate smuggling attempts.

