[nginx] HTTP/2: fixed send window refunding on stream reset.
Maxim Dounin
mdounin at mdounin.ru
Tue Nov 24 15:44:03 UTC 2026
details: http://freenginx.org/hg/nginx/rev/db1e17bc592b
branches:
changeset: 9607:db1e17bc592b
user: Maxim Dounin <mdounin at mdounin.ru>
date: Tue Nov 24 06:19:18 2026 +0300
description:
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
diffstat:
src/http/v2/ngx_http_v2_filter_module.c | 9 ++++++++-
1 files changed, 8 insertions(+), 1 deletions(-)
diffs (19 lines):
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