]> git.kaiwu.me - haproxy.git/commit
BUG/MEDIUM: stconn: Do not install an applet on a busy stream connector
authorChristopher Faulet <cfaulet@haproxy.com>
Thu, 19 Nov 2026 18:00:00 +0000 (19:00 +0100)
committerChristopher Faulet <cfaulet@haproxy.com>
Mon, 23 Nov 2026 13:34:02 +0000 (14:34 +0100)
commit99d3da756567622447c9dbc256102dad0295883f
tree57046080a68b1da8ba8e25837516d432d62e45e9
parent76d0e0d29e79a1338bb373a3b135617ca0a4cd4c
BUG/MEDIUM: stconn: Do not install an applet on a busy stream connector

It is possible to install an applet on a stream connector with an applet
already attached. This could happen with a "http-request cache-use" rule
followed by a matching "http-request use-service" rule, when the
cache-use rule hits. The use-service rule installs a second applet on the
same stream connector, replacing the cache one, which is leaked with its
retained cache row. The commit a72de1022 ("BUG/MEDIUM: cache: do not
create a second applet when two cache-use rules hit") only fixed the case
of two cache-use rules. The use-service rules are still vulnerable.

To fix the issue, sc_applet_create() now checks the SE_FL_DETACHED flag
and fails if it is not set. This flag is set when the stream connector is
created and it is cleared when an endpoint is attached, a mux or an
applet, and it is set again by sc_reset_endp() when the endpoint is
reset, to be able to retry a connection. Thus, it is not possible to
install an applet on a stream connector with an applet already attached
anymore.

This patch should be backported to all supported versions. The commit
a72de1022 is not present in the stable branches and the same weakness
exists there since sc_applet_create() was introduced in 2.6.
src/stconn.c