Skip to content

Commit 31d33ea

Browse files
committed
BUG/MAJOR: quic: reject invalid token
Token parsing code on INITIAL packet for the NEW_TOKEN format is not robust enough and may even crash on some rare malformed packets. This patch fixes this by adding a check on the expected length of the received token. The packet is now rejected if the token does not match QUIC_TOKEN_LEN. This check is legitimate as haproxy should only parse tokens emitted by itself. This issue has been introduced with the implementation of NEW_TOKEN tokens parsing required for 0-RTT support. This issue is assigned to CVE-2026-26081 report. This must be backported up to 3.0. Reported-by: Asim Viladi Oglu Manizada <manizada@pm.me> (cherry picked from commit 4aa974f) Signed-off-by: Amaury Denoyelle <adenoyelle@haproxy.com> (cherry picked from commit b9b182b) Signed-off-by: Amaury Denoyelle <adenoyelle@haproxy.com> (cherry picked from commit 4765277) Signed-off-by: Amaury Denoyelle <adenoyelle@haproxy.com>
1 parent 4e95eef commit 31d33ea

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

src/quic_token.c

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -129,6 +129,11 @@ int quic_token_check(struct quic_rx_packet *pkt,
129129
goto err;
130130
}
131131

132+
if (tokenlen != QUIC_TOKEN_LEN) {
133+
TRACE_ERROR("invalid token length", QUIC_EV_CONN_LPKT, qc);
134+
goto err;
135+
}
136+
132137
/* Generate the AAD. */
133138
aadlen = ipaddrcpy(aad, &dgram->saddr);
134139
rand = token + tokenlen - QUIC_TOKEN_RAND_DLEN;

0 commit comments

Comments
 (0)