]> git.kaiwu.me - nginx.git/commit
Upstream: limit response header field sizes for HTTP/2 and gRPC
authorZhidao HONG <z.hong@f5.com>
Mon, 8 Jun 2026 03:52:24 +0000 (03:52 +0000)
committerhongzhidao <hongzhidao@gmail.com>
Tue, 14 Jul 2026 12:38:57 +0000 (20:38 +0800)
commit44c66e92c88bf2367dd31efc9d5843c0838d11f2
treef822871d32da9c2db99f8087ebbf3293d1d8adc4
parent5f92d7afb8b55f9ae5bb67256fa52f96c59eda3e
Upstream: limit response header field sizes for HTTP/2 and gRPC

HTTP/2 and gRPC upstream response header parsing used the HPACK string
length to allocate header name and value buffers.  The length was not
checked against the configured upstream buffer size before allocation.
A malicious upstream could force nginx to allocate excessive
request-pool memory before the header was rejected.

Reject oversized HTTP/2 header name and value lengths before allocation.
Also keep a per-header-block limit based on the upstream buffer size, so
a header block cannot consume unbounded memory across fields.
src/http/modules/ngx_http_grpc_module.c
src/http/modules/ngx_http_proxy_v2_module.c