BUG/MEDIUM: h1: Don't support LF only to mark the end of a chunk size
authorChristopher Faulet <cfaulet@haproxy.com>
Fri, 26 Jan 2024 15:30:53 +0000 (16:30 +0100)
committerWilly Tarreau <w@1wt.eu>
Wed, 31 Jan 2024 14:51:27 +0000 (15:51 +0100)
commite6dc7670438f1cf87b7f16fc78365e130ecba295
treeaff9feabe8da27ded67a611f4216fdd4d13a4644
parent787b67ddf1512b0b2c8740c2e4018e86d0797fa6
BUG/MEDIUM: h1: Don't support LF only to mark the end of a chunk size

It is similar to the previous fix but for the chunk size parsing. But this
one is more annoying because a poorly coded application in front of haproxy
may ignore the last digit before the LF thinking it should be a CR. In this
case it may be out of sync with HAProxy and that could be exploited to
perform some sort or request smuggling attack.

While it seems unlikely, it is safer to forbid LF with CR at the end of a
chunk size.

This patch must be backported to 2.9 and probably to all stable versions
because there is no reason to still support LF without CR in this case.

(cherry picked from commit 4837e998920cbd4e43026e0a638b8ebd71c8018f)
Signed-off-by: Willy Tarreau <w@1wt.eu>
include/haproxy/h1.h
src/h1_htx.c