Skip to content

ngtcp2: a ClientHello without quic_transport_parameters is refused with missing_extension instead of aborting the process (#639) - #646

Open
MDA2AV wants to merge 1 commit into
mainfrom
fix-639
Open

MDA2AV wants to merge 1 commit into
mainfrom
fix-639

Conversation

@MDA2AV

@MDA2AV MDA2AV commented Nov 17, 2026

Copy link
Copy Markdown
Owner

Fixes #639.

A ClientHello without the quic_transport_parameters extension, or with only the draft codepoint 0xffa5, aborted the process: one Initial packet from anyone took an HTTP/3 server down (ngtcp2_conn.c:3633: conn_write_pkt: Assertion 'conn->negotiated_version' failed). h3spec v0.1.15's two missing_extension [TLS 8.2] cases did it every time, and every case after them then failed against a dead server, which is what HttpArena's genhttp-ioxide shows as "crashed".

Why. ngtcp2's picotls glue (ngtcp2_crypto_picotls_collected_extensions) hands the extension on when it is there and returns 0 when it is not, so picotls finished the server's side of the handshake without the client's transport parameters. A server takes its negotiated version from them, and ngtcp2 checks they arrived only at handshake completion, after the server's first 1-RTT packet has already asserted on the version. ngtcp2 keeps assertions in Release builds on purpose. The gap is ngtcp2's and is still on its main.

The change.

  • iq_collected_extensions in the shim, installed right after ngtcp2_crypto_picotls_configure_server_session: it calls ngtcp2's function when quic_transport_parameters is among the collected extensions, and otherwise returns PTLS_ALERT_MISSING_EXTENSION, the alert RFC 9001 8.2 requires. picotls calls it with whatever it collected, an empty list included, so the draft-only hello is refused too. picotls's glue turns the alert into NGTCP2_ERR_CRYPTO, and the connection closes as any failed handshake does. Server only: a client already fails at handshake completion on a server that leaves them out, and has no 1-RTT packet to write before then.
  • libioxide_ngtcp2.so rebuilt for linux-x64 and linux-arm64 with scripts/build-ngtcp2-native.sh at the pinned refs, GCC 13.3 on Ubuntu 24.04 (arm64 cross-built in an ubuntu:24.04 container). Both still need GLIBC_2.38 and export the same 35 iq_ functions.

What a caller notices. Such a hello now gets a CONNECTION_CLOSE and the server goes on serving. Until #638 the close carries PROTOCOL_VIOLATION rather than CRYPTO_ERROR 0x16d. No managed API changes.

Tests.

  • QuicTransportParameterTests (E2E, new): a hand-built ClientHello without the extension, and one carrying only 0xffa5, are closed without a ServerHello, and the same server then answers a well-formed hello with a ServerHello.
  • QuicSniHostileTests.Hello takes which transport parameters extension to carry (v1 by default, so its own tests send what they sent), and its engine and server fixtures are shared.

Seen failing without the change: with the previous libioxide_ngtcp2.so in the test output, the first new test aborted the whole test host with the same assertion (exit 134). The SNI tests before it passed.

Suites (linux-x64): Unit 306/0/0, E2E 799/0/0, Chaos 105/0/0. linux-arm64 has only been built here, not run; CI's arm64 leg runs it.

For review. The arm64 build needed several attempts on this machine: gcc hit internal compiler errors at full parallelism, and it built cleanly on 4 cores. Worth a glance that CI's arm64 leg is green.

…th missing_extension instead of aborting the process (#639)

RFC 9001 8.2 makes a ClientHello without the quic_transport_parameters
extension a missing_extension alert. ngtcp2's picotls glue passes the
extension on only when it is there and returns 0 when it is not, so the
handshake went on without the client's transport parameters. A server
learns its negotiated version from them, and ngtcp2 checks that they
arrived only once the handshake completes; the first 1-RTT packet the
server wrote before then failed assert(conn->negotiated_version), which
ngtcp2 keeps in Release builds, and aborted the process.

The shim now wraps the collected_extensions callback that
ngtcp2_crypto_picotls_configure_server_session installs: without the
extension among those collected, which includes a hello carrying only the
draft codepoint 0xffa5, it returns PTLS_ALERT_MISSING_EXTENSION, and the
connection closes. libioxide_ngtcp2.so rebuilt for linux-x64 and
linux-arm64 at the pinned refs.

QuicTransportParameterTests: a hand-built ClientHello without the
extension, and one with only 0xffa5, are refused, and the same server then
answers a well-formed one. With the previous libioxide_ngtcp2.so the first
of them aborted the test host at ngtcp2_conn.c:3633.

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

ngtcp2: a ClientHello without the quic_transport_parameters extension aborts the process, so one Initial packet takes an HTTP/3 server down

1 participant