Skip to content

Commit 56205f9

Browse files
netty: Fix client-initiated stream limit bypass in NettyServerHandler (#12933)
Configure connection.remote().maxActiveStreams(maxStreams) directly upon `DefaultHttp2Connection` initialization. Because `NettyServerHandler` instantiates `DefaultHttp2Connection` directly rather than using Netty's `AbstractHttp2ConnectionHandlerBuilder`, it missed Netty's built-in CVE-2026-47244 patch. This left a pre-handshake window where the server's local connection allowed up to Integer.MAX_VALUE active client-initiated streams until a SETTINGS_ACK was received. Enforcing the limit proactively at startup closes this vulnerability window and prevents client-initiated stream floods / resource exhaustion. Fixes #12930
1 parent e2027a4 commit 56205f9

2 files changed

Lines changed: 9 additions & 0 deletions

File tree

netty/src/main/java/io/grpc/netty/NettyServerHandler.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -252,6 +252,7 @@ static NettyServerHandler newHandler(
252252
maxMessageSize);
253253

254254
final Http2Connection connection = new DefaultHttp2Connection(true);
255+
connection.remote().maxActiveStreams(maxStreams);
255256
UniformStreamByteDistributor dist = new UniformStreamByteDistributor(connection);
256257
dist.minAllocationChunk(MIN_ALLOCATED_CHUNK); // Increased for benchmarks performance.
257258
DefaultHttp2RemoteFlowController controller =

netty/src/test/java/io/grpc/netty/NettyServerHandlerTest.java

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -454,6 +454,14 @@ public void shouldAdvertiseMaxConcurrentStreams() throws Exception {
454454
assertEquals(maxConcurrentStreams, captor.getValue().maxConcurrentStreams().longValue());
455455
}
456456

457+
@Test
458+
public void connectionRemoteMaxActiveStreamsShouldBeEnforcedLocallyOnStartup() throws Exception {
459+
maxConcurrentStreams = 314;
460+
manualSetUp();
461+
462+
assertEquals(maxConcurrentStreams, connection().remote().maxActiveStreams());
463+
}
464+
457465
@Test
458466
public void shouldAdvertiseMaxHeaderListSize() throws Exception {
459467
maxHeaderListSize = 123;

0 commit comments

Comments
 (0)