Summary
Netty's HttpClientCodec improperly pairs HTTP responses with their corresponding requests when informational 1xx responses are involved, causing the client to associate response bodies with the wrong requests.
Under specific pipelined request patterns (such as a GET followed by a HEAD) and certain server behaviors, this can desynchronize the HTTP stream, leading to misparsed responses and potentially unsafe application behavior.
Affected context
This issue affects applications using Netty as an HTTP client via HttpClientCodec, particularly where:
- HTTP/1.1 pipelining is used (multiple requests sent without waiting for prior responses), and
- Servers may send informational 1xx responses (e.g., 103 Early Hints) before final 2xx responses, and
- Different HTTP methods (such as GET and HEAD) are pipelined on the same connection.
In such scenarios, the client's internal request–response pairing can fall out of sync, causing subsequent responses to be interpreted as belonging to the wrong request.
Exploit preconditions
- Attack surface: HTTP/1.1 client connections managed by Netty's HttpClientCodec.
- Required access: Ability to influence or act as the HTTP server (or an on-path intermediary) responding to Netty-based clients.
- Trigger pattern:
- The Netty client pipelines multiple requests (e.g., a GET followed by a HEAD).
- The server sends a 1xx informational response (such as 103) and then multiple 2xx responses.
- The response sequence causes the queue of pending requests to advance one step too far.
- Why exploitation is possible:
- HttpClientCodec uses a simple
queue.poll()per received response status, including 1xx, treating them like final responses. - When a HEAD request is mistakenly matched with a GET response, its special "no body" handling causes the actual GET body bytes to remain unread on the stream.
- Subsequent responses are then parsed from the wrong byte offset, effectively desynchronizing the HTTP protocol stream.
Why this happens
The root cause is a protocol state management bug in Netty's HttpClientCodec, which maps to CWE-444: Inconsistent Interpretation of HTTP Requests.
HttpClientCodec maintains a queue of outbound requests to match with inbound responses.
It incorrectly advances this queue for interim 1xx responses, instead of only for final responses.
When a HEAD request is in the queue, the codec applies special handling to skip reading a body, but if it has been paired with a response that actually has a body (e.g., the GET's 200 response), the body is left unread on the stream.
This misalignment can corrupt the client's view of subsequent messages, as the parser reads from an incorrect position and attributes response data to the wrong request.
Potential impact
- HTTP responses for one request can be interpreted as belonging to another request.
- Clients may treat data from a prior request's body as part of subsequent responses, leading to corrupted application state.
- Security controls implemented at the application layer (e.g., authorization checks tied to specific requests) can be bypassed if responses become misattributed.
- Data integrity issues may occur, such as mixing cached content, leaking information between logically separate operations, or misapplying server instructions.
- In multi-tenant or multi-user client flows, there can be cross-request data exposure at the client side if responses are correlated to the wrong logical operation.
General mitigation guidance
Mitigation centers on robust protocol handling and defensive client configuration rather than one-off patches:
- Prefer HTTP clients that implement strict state machines for request/response matching, especially in the presence of 1xx informational responses.
- Avoid or strictly limit HTTP/1.1 pipelining unless the client library's behavior around 1xx and non-body methods (e.g., HEAD) is well understood and well tested.
- Treat informational responses as a distinct state, ensuring they do not advance the "final response" queue for request pairing.
- At a design level, avoid mixing different HTTP methods with divergent body semantics (such as GET and HEAD) on the same pipelined connection where possible.
- Apply the principle of least privilege on the client side: restrict what actions can be taken based solely on a single response, and require coherent request–response context checks in higher-level logic.
How teams detect issues like this
Detection typically focuses on protocol behavior and state tracking:
- Static analysis / code review:
- Look for usage of HttpClientCodec in contexts where HTTP/1.1 pipelining is enabled or multiple requests share a single connection.
- Review code that assumes a one-to-one, strictly ordered mapping between requests and responses without accounting for 1xx responses.
- Flag custom logic that relies on special handling of HEAD or other no-body methods without explicit protocol state checks.
- Runtime / integration testing:
- Add tests that simulate servers sending 1xx (e.g., 103) followed by multiple 2xx responses to pipelined GET/HEAD sequences, and verify that responses are matched to correct requests.
- Use HTTP protocol fuzzing tools or integration tests that exercise edge cases in request sequencing and informational responses.
- Operational monitoring:
- Log and inspect anomalies where response parsing errors, unexpected headers, or mismatched correlation IDs are observed on the client side.
- Monitor for recurring parsing exceptions or unexpected end-of-stream conditions immediately after receiving informational responses.
Automated review tools and protocol-aware fuzzers can help surface such state machine inconsistencies before deployment.

