]> git.ipfire.org Git - thirdparty/haproxy.git/commit
BUG/MEDIUM: h1/h2/h3: reject forbidden chars in the Host header field
authorWilly Tarreau <w@1wt.eu>
Fri, 16 May 2025 12:58:52 +0000 (14:58 +0200)
committerWilly Tarreau <w@1wt.eu>
Fri, 16 May 2025 13:13:17 +0000 (15:13 +0200)
commitdf00164fdd98d15e832daad34fb23249083bfb9c
tree3c95d287e25c943094b267c4c353843e9bff31d5
parentb84762b3e0c0e7708ddc98ae6b721ed10dc1be30
BUG/MEDIUM: h1/h2/h3: reject forbidden chars in the Host header field

In continuation with 9a05c1f574 ("BUG/MEDIUM: h2/h3: reject some
forbidden chars in :authority before reassembly") and the discussion
in issue #2941, @DemiMarie rightfully suggested that Host should also
be sanitized, because it is sometimes used in concatenation, such as
this:

    http-request set-url https://%[req.hdr(host)]%[pathq]

which was proposed as a workaround for h2 upstream servers that require
:authority here:

    https://www.mail-archive.com/haproxy@formilux.org/msg43261.html

The current patch then adds the same check for forbidden chars in the
Host header, using the same function as for the patch above, since in
both cases we validate the host:port part of the authority. This way
we won't reconstruct ambiguous URIs by concatenating Host and path.

Just like the patch above, this can be backported afer a period of
observation.
src/h1.c
src/h2.c
src/h3.c