]> git.kaiwu.me - nginx.git/commitdiff
QUIC: rejected CRYPTO frames received in 1-RTT packets
authorVadim Zhestikov <v.zhestikov@f5.com>
Wed, 12 Aug 2026 19:41:54 +0000 (12:41 -0700)
committerSergey Kandaurov <pluknet@nginx.com>
Fri, 2 Oct 2026 14:33:28 +0000 (18:33 +0400)
If a CRYPTO frame was received after the handshake, ngx_quic_handshake()
ran the handshake completion for the second time.  With the check added
in 6f8c520f4, this is limited to short header packets.

Since a client has nothing to send in a CRYPTO frame once the handshake
is complete, such frames are now rejected with the "unexpected_message"
connection error, as does TLS 1.3 for handshake messages received out of
order, and QUIC requires for KeyUpdate.

src/event/quic/ngx_event_quic_ssl.c

index 18992ae1be6fc18d440f2cb19dd3788d8210c3c0..8173bc85598fb4becd86e335ac4c38d984460835 100644 (file)
@@ -642,6 +642,15 @@ ngx_quic_handle_crypto_frame(ngx_connection_t *c, ngx_quic_header_t *pkt,
         return NGX_OK;
     }
 
+    if (c->ssl->handshaked) {
+        /* QUIC doesn't define post-handshake messages for a client */
+
+        qc->error = NGX_QUIC_ERR_CRYPTO(SSL_AD_UNEXPECTED_MESSAGE);
+        qc->error_reason = "unexpected CRYPTO frame";
+
+        return NGX_ERROR;
+    }
+
     ctx = ngx_quic_get_send_ctx(qc, pkt->level);
     f = &frame->u.crypto;