]> git.kaiwu.me - haproxy.git/commit
BUG/MINOR: mux-h2: Reject trailers received on a tunneled stream
authorChristopher Faulet <cfaulet@haproxy.com>
Fri, 11 Sep 2026 15:43:13 +0000 (17:43 +0200)
committerChristopher Faulet <cfaulet@haproxy.com>
Fri, 18 Sep 2026 15:05:18 +0000 (17:05 +0200)
commit3a2f727536dc1b1cf12701b1af2508c66456c8df
treefea6f5fd83accf72e36720428cbe66f025d562cb
parentdee32a05d7ed2391801ea40a631b9dd468e8312b
BUG/MINOR: mux-h2: Reject trailers received on a tunneled stream

For a tunneled stream, the end of the HTTP message is reported just after
the headers. It is an "early" EOM: from the HTTP point of view, the message
is finished and only tunneled data may be exchanged then.

However, a HEADERS frame received after the initial one on such a stream
was still handled as a trailers block. The trailers were thus pushed in an
HTTP message already ended, leading to an invalid HTX message where blocks
are inserted after the end of the message. The stream is then aborted when
the outgoing multiplexer handles the unexpected block. So a client is able
to kill its own tunnel by sending a bogus HEADERS frame.

Such a frame is now rejected with a stream error (PROTOCOL_ERROR). The test
is performed in h2c_dec_hdrs(), at the only place where a HEADERS frame is
identified as a trailers block. This way, both directions are covered. The
aborted tunnel attempts are also covered because the early EOM was reported
in that case too.

This patch should be backported to all stable versions. Note that
h2c_report_glitch() only exists since 3.0. The corresponding line must be
removed for older versions.
src/mux_h2.c