[PATCH 01 of 10] HTTP/2: fixed send window refunding on stream reset

Maxim Dounin mdounin at mdounin.ru
Tue Nov 24 00:27:04 UTC 2026


# HG changeset patch
# User Maxim Dounin <mdounin at mdounin.ru>
# Date 1795479760 -10800
#      Tue Nov 24 03:22:40 2026 +0300
# Node ID 8e67e5a054a991801d1f3de376c7c2c7699cf932
# Parent  146c43e035acbde493604cf4645ac3186a2cc896
HTTP/2: fixed send window refunding on stream reset.

Previously, if a stream was terminated, unsent frames were refunded to
the connection send window and might make it larger than the allowed
maximum, NGX_HTTP_V2_MAX_WINDOW.  This in turn made it possible to
further increase the window with additional window updates, which were
accepted by ngx_http_v2_state_window_update() whenever h2c->send_window
was already above NGX_HTTP_V2_MAX_WINDOW, and eventually cause off_t
overflow in ngx_http_v2_send_chain(), leading to generation of buffers
with negative size.  This resulted in segmentation faults and other
issues, including code execution on some platforms (CVE-2026-123007).

The fix is to make sure that h2c->send_window is never increased above
the allowed maximum, NGX_HTTP_V2_MAX_WINDOW.

See also:
https://github.com/nginx/nginx/commit/e27f5fa84fe6e98505e70bc543b748747dad0a3b

diff --git a/src/http/v2/ngx_http_v2_filter_module.c b/src/http/v2/ngx_http_v2_filter_module.c
--- a/src/http/v2/ngx_http_v2_filter_module.c
+++ b/src/http/v2/ngx_http_v2_filter_module.c
@@ -1582,7 +1582,14 @@ ngx_http_v2_filter_cleanup(void *data)
         }
     }
 
-    h2c->send_window += window;
+    if (window > NGX_HTTP_V2_MAX_WINDOW
+        || h2c->send_window > NGX_HTTP_V2_MAX_WINDOW - window)
+    {
+        h2c->send_window = NGX_HTTP_V2_MAX_WINDOW;
+
+    } else {
+        h2c->send_window += window;
+    }
 }
 
 



More information about the nginx-devel mailing list