]> git.ipfire.org Git - thirdparty/haproxy.git/commit
BUG/MAJOR: h2: make header field name filtering stronger
authorWilly Tarreau <w@1wt.eu>
Sun, 24 Nov 2019 09:34:39 +0000 (10:34 +0100)
committerWilly Tarreau <w@1wt.eu>
Mon, 25 Nov 2019 10:11:32 +0000 (11:11 +0100)
commit146f53ae7e97dbfe496d0445c2802dd0a30b0878
treec2a532f55268f4047407dac28957098c159ce6bf
parent54f53ef7ce4102be596130b44c768d1818570344
BUG/MAJOR: h2: make header field name filtering stronger

Tim Düsterhus found that the amount of sanitization we perform on HTTP
header field names received in H2 is insufficient. Currently we reject
upper case letters as mandated by RFC7540#8.1.2, but section 10.3 also
requires that intermediaries translating streams to HTTP/1 further
refine the filtering to also reject invalid names (which means any name
that doesn't match a token). There is a small trick here which is that
the colon character used to start pseudo-header names doesn't match a
token, so pseudo-header names fall into that category, thus we have to
swap the pseudo-header name lookup with this check so that we only check
from the second character (past the ':') in case of pseudo-header names.

Another possibility could have been to perform this check only in the
HTX-to-H1 trancoder but doing would still expose the configured rules
and logs to such header names.

This fix must be backported as far as 1.8 since this bug could be
exploited and serve as the base for an attack. In 2.0 and earlier,
functions h2_make_h1_request() and h2_make_h1_trailers() must also
be adapted to sanitize requests coming in legacy mode.
src/h2.c