jingjin / rpms / haproxy

Forked from rpms/haproxy 4 years ago
Clone

Blame SOURCES/bz1664533-fix-handling-priority-flag-HTTP2-decoder.patch

70b95c
From 57c9ecf43f1ae0211367d8ba79540e3a5d288d34 Mon Sep 17 00:00:00 2001
70b95c
From: Willy Tarreau <w@1wt.eu>
70b95c
Date: Mon, 31 Dec 2018 07:41:24 +0100
70b95c
Subject: BUG/CRITICAL: mux-h2: re-check the frame length when PRIORITY is used
70b95c
MIME-Version: 1.0
70b95c
Content-Type: text/plain; charset=latin1
70b95c
Content-Transfer-Encoding: 8bit
70b95c

70b95c
Tim Düsterhus reported a possible crash in the H2 HEADERS frame decoder
70b95c
when the PRIORITY flag is present. A check is missing to ensure the 5
70b95c
extra bytes needed with this flag are actually part of the frame. As per
70b95c
RFC7540#4.2, let's return a connection error with code FRAME_SIZE_ERROR.
70b95c

70b95c
Many thanks to Tim for responsibly reporting this issue with a working
70b95c
config and reproducer. This issue was assigned CVE-2018-20615.
70b95c

70b95c
This fix must be backported to 1.9 and 1.8.
70b95c
---
70b95c
 src/mux_h2.c | 5 +++++
70b95c
 1 file changed, 5 insertions(+)
70b95c

70b95c
diff --git a/src/mux_h2.c b/src/mux_h2.c
70b95c
index 5803a84ff..a67bbb049 100644
70b95c
--- a/src/mux_h2.c
70b95c
+++ b/src/mux_h2.c
70b95c
@@ -3297,6 +3297,11 @@ next_frame:
70b95c
 			goto fail;
70b95c
 		}
70b95c
 
70b95c
+		if (flen < 5) {
70b95c
+			h2c_error(h2c, H2_ERR_FRAME_SIZE_ERROR);
70b95c
+			goto fail;
70b95c
+		}
70b95c
+
70b95c
 		hdrs += 5; // stream dep = 4, weight = 1
70b95c
 		flen -= 5;
70b95c
 	}
70b95c
-- 
70b95c
2.20.1
70b95c