]> git.ipfire.org Git - thirdparty/haproxy.git/commit
BUG/MAJOR: mux-h1: Prevent any UAF on H1 connection after draining a request
authorChristopher Faulet <cfaulet@haproxy.com>
Wed, 12 Jun 2024 12:59:20 +0000 (14:59 +0200)
committerChristopher Faulet <cfaulet@haproxy.com>
Wed, 12 Jun 2024 14:12:47 +0000 (16:12 +0200)
commit0e09cce0fdf104994b37a492e256d3bc37880ddc
treefcb089ccefe7670560df15a206491244b4f9a23b
parent82a4dd7df69973c8123c73cf7b140685596a73e0
BUG/MAJOR: mux-h1: Prevent any UAF on H1 connection after draining a request

Since 2.9, it is possible to drain the request payload from the H1
multiplexer in case of early reply. When this happens, the upper stream is
detached but the H1 stream is not destroyed. Once the whole request is
drained, the end of the detach stage is finished. So the H1 stream is
destroyed and the H1 connection is ready to be reused, if possible,
otherwise it is released.

And here is the issue. If some data of the next request are received with
last bytes of the drained one, parsing of the next request is immediately
started. The previous H1 stream is destroyed and a new one is created to
handle the parsing.  At this stage the H1 connection may be released, for
instance because of a parsing error. This case was not properly handled.
Instead of immediately exiting the mux, it was still possible to access the
released H1 connection to refresh its timeouts, leading to a UAF issue.

Many thanks to Annika for her invaluable help on this issue.

The patch should fix the issue #2602. It must be backported as far as 2.9.
src/mux_h1.c