diff --git a/CVE-2021-22883.patch b/CVE-2021-22883.patch new file mode 100644 index 0000000000000000000000000000000000000000..4e50657705fc1972cdfa3fe27089c141ba950600 --- /dev/null +++ b/CVE-2021-22883.patch @@ -0,0 +1,219 @@ +From 922ada77132c1b0b69c9a146822d762b2f9b912b Mon Sep 17 00:00:00 2001 +From: Daniel Bevenius +Date: Fri, 22 Jan 2021 12:34:21 +0100 +Subject: [PATCH] http2: add unknownProtocol timeout +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +This commit add a configuration options named unknownProtocolTimeout +which can be specified to set a value for the timeout in milliseconds +that a server should wait when an unknowProtocol is sent to it. When +this happens a timer will be started and the if the socket has not been +destroyed during that time the timer callback will destoy it. + +Refs: https://hackerone.com/reports/1043360 +CVE-ID: CVE-2021-22883 +PR-URL: https://github.com/nodejs/node/pull/246 +Backport-PR-URL: https://github.com/nodejs/node/pull/250 +Reviewed-By: Beth Griggs +Reviewed-By: Matteo Collina +Reviewed-By: Michael Dawson +Reviewed-By: Rich Trott +Reviewed-By: Tobias Nießen +Reference: https://github.com/nodejs/node/commit/922ada77132c1b0b69c9a146822d762b2f9b912b +--- + doc/api/http2.md | 25 +++++++++++++- + lib/internal/http2/core.js | 31 ++++++++++++++--- + .../test-http2-server-unknown-protocol.js | 33 +++++++++++++++++++ + 3 files changed, 84 insertions(+), 5 deletions(-) + create mode 100644 test/parallel/test-http2-server-unknown-protocol.js + +diff --git a/doc/api/http2.md b/doc/api/http2.md +index 40a107f..d57a560 100644 +--- a/doc/api/http2.md ++++ b/doc/api/http2.md +@@ -1908,7 +1908,9 @@ added: v8.4.0 + The `'unknownProtocol'` event is emitted when a connecting client fails to + negotiate an allowed protocol (i.e. HTTP/2 or HTTP/1.1). The event handler + receives the socket for handling. If no listener is registered for this event, +-the connection is terminated. See the [Compatibility API][]. ++the connection is terminated. A timeout may be specified using the ++`'unknownProtocolTimeout'` option passed to [`http2.createSecureServer()`][]. ++See the [Compatibility API][]. + + #### `server.close([callback])` +