From: Vadim Zhestikov Date: Fri, 6 Nov 2026 21:42:48 +0000 (-0800) Subject: QUIC: rejected NEW_CONNECTION_ID from a client with zero-length ids X-Git-Url: https://git.kaiwu.me/http/%22../$%7BGITURL%7D/static/gitweb.js?a=commitdiff_plain;h=fa2a49a47d3fff7cc7eb7b78307008caa50250dc;p=nginx.git QUIC: rejected NEW_CONNECTION_ID from a client with zero-length ids A client that selected a zero-length connection id during the handshake cannot issue new connection ids, and an endpoint sending packets with a zero-length Destination Connection ID must treat receipt of a NEW_CONNECTION_ID frame as a connection error of type PROTOCOL_VIOLATION, see RFC 9000, 19.15. Instead, the frame was accepted and the connection id it carried was added to the client ids. --- diff --git a/src/event/quic/ngx_event_quic_connid.c b/src/event/quic/ngx_event_quic_connid.c index b76eaaa5f..aac4f761c 100644 --- a/src/event/quic/ngx_event_quic_connid.c +++ b/src/event/quic/ngx_event_quic_connid.c @@ -81,6 +81,20 @@ ngx_quic_handle_new_connection_id_frame(ngx_connection_t *c, qc = ngx_quic_get_connection(c); + if (qc->path->cid->len == 0) { + /* + * RFC 9000, 19.15. NEW_CONNECTION_ID Frames + * + * An endpoint that is sending packets with a zero-length + * Destination Connection ID MUST treat receipt of + * a NEW_CONNECTION_ID frame as a connection error of type + * PROTOCOL_VIOLATION. + */ + qc->error = NGX_QUIC_ERR_PROTOCOL_VIOLATION; + qc->error_reason = "new connection id from client with zero-length id"; + return NGX_ERROR; + } + if (f->seqnum < qc->max_retired_seqnum) { /* * RFC 9000, 19.15. NEW_CONNECTION_ID Frame