]> git.ipfire.org Git - thirdparty/haproxy.git/commit
BUG/MINOR: tcpcheck: Check LDAP response to not read more data than available
authorChristopher Faulet <cfaulet@haproxy.com>
Wed, 27 May 2026 07:16:37 +0000 (09:16 +0200)
committerChristopher Faulet <cfaulet@haproxy.com>
Wed, 27 May 2026 07:30:00 +0000 (09:30 +0200)
commit31cd3d13aaa760af27b7c2eba57da19274b51a61
tree4cf31f8df2e3ba9da52a0d34ae97c64f54fcceef
parent88da61e21809b33954215ce3faf7ced3a7331b3d
BUG/MINOR: tcpcheck: Check LDAP response to not read more data than available

tcpcheck_ldap_expect_bindrsp() parses ASN.1 BER-encoded LDAP responses from
the health check target. After reading the outer message size and validating
protocol fields, it encounters a long-form BER length for the bindResponse
value (high bit set in the length byte). The code reads nbytes = (*ptr &
0x7f) then advances ptr by 1 + nbytes without checking that enough bytes
remain in the receive buffer. So, it is possible to read more data than
available.

Note that it is only possible if the LDAP response was forged because the
message length was already checked. LDAP response remains quite short and it
is not possible to read outside the buffer area. So at worst, garbage are
parsed and a wrong result is reported by the LDAP health-check. Most
probably an error will be reported.

This patch could be backported to all stable versions.
src/tcpcheck.c