]> git.kaiwu.me - haproxy.git/commit
BUG/MINOR: connection: check the IP header length in NetScaler CIP
authorMartin Mirchev <mmirchev@comp.nus.edu.sg>
Tue, 27 Oct 2026 06:17:35 +0000 (14:17 +0800)
committerWilly Tarreau <w@1wt.eu>
Wed, 28 Oct 2026 10:38:26 +0000 (11:38 +0100)
commitf5359da6e387e18dc76d17e40df2c2c05ae91719
tree11bd86e3668b272691f15cd15524721b6a8e1d75
parente00364a7b9071679cc6a72021bdd041a00a7cd6a
BUG/MINOR: connection: check the IP header length in NetScaler CIP

conn_recv_netscaler_cip() takes the TCP ports at ip_hl * 4 bytes after the
start of the IPv4 header without checking ip_hl nor that the announced
header length covers them:

  - with ip_hl < 5 the ports are taken from the IPv4 header itself (e.g.
    ip_hl=0 gives source port 16384 from the version/IHL byte);
  - with a header length shorter than ip_hl * 4 + 4 (e.g. ip_hl=15 and a
    40-byte header) they are taken from the payload or from bytes past the
    received data, which are leftovers of the previous use of the trash
    buffer, possibly from another connection.

The same applies to IPv6 with a header length shorter than 44 bytes. The
reads stay inside the trash buffer, so this is not a memory safety issue,
but the session addresses end up with wrong ports. Let's reject such
headers with CO_ER_CIP_BAD_PROTO.

This should be backported to all stable versions.
src/connection.c