Commit e03013166f for openssl.org
commit e03013166fe56dacc00556951f4a6f021fea7fe4
Author: Alexandr Nedvedicky <sashan@openssl.org>
Date: Mon Nov 2 15:59:56 2026 +0100
QUIC client: fix off-path Version Negotiation with wrong SCID aborting handshake
An off-path attacker who can forge the server's source address could
make a QUIC client's connection attempt fail by sending one 11-byte
Version Negotiation packet to the client's UDP port. SSL_connect()
then returned failure with CONNECTION_REFUSED "unsupported protocol
version". The attacker never saw any traffic. They need only
the server's address, port, and a correct guess of the client's port,
and the packet had to arrive during the first round trip, before
the client processes the server's first reply. Nothing crashed,
and servers and connections that have already processed a packet
from the server are not affected.
Add a check for the server SCID matching the initial DCID (and a silent
rejection of the packet silently on mismatch) in the version negotiation
packet handling code path in ch_rx_handle_packet().
Fixes: 78702fb7d63b "Handle the receipt of version negotiation packets"
Reported-by: Anthropic's OSS Scanner (finding ANT-2026-6CXTP19B)
Reviewed-by: Andrew Dinh <andrewd@openssl.org>
Reviewed-by: Bob Beck <beck@openssl.org>
Reviewed-by: Eugene Syromiatnikov <esyr@openssl.org>
Merge-date: Mon Nov 23 13:31:27 2026
Merged-from: https://github.com/openssl/openssl/pull/33490
diff --git a/ssl/quic/quic_channel.c b/ssl/quic/quic_channel.c
index a907207812..b9784fa9f7 100644
--- a/ssl/quic/quic_channel.c
+++ b/ssl/quic/quic_channel.c
@@ -2493,6 +2493,9 @@ static void ch_rx_handle_packet(QUIC_CHANNEL *ch, int channel_only)
if (ch->qrx_pkt->hdr->version != 0)
return;
+ if (!ossl_quic_conn_id_eq(&ch->qrx_pkt->hdr->src_conn_id, &ch->init_dcid))
+ return;
+
/*
* RFC 9000 s. 6.2: If a client receives a version negotiation
* packet, we need to do the following: