WebRTC DTLS handshake stalls on TURN relay-only paths in Firefox 146 — oversized ClientHello from default ML-KEM key share (mlkem768x25519)
Categories
(Core :: WebRTC: Networking, defect, P3)
Tracking
()
| Tracking | Status | |
|---|---|---|
| firefox158 | --- | fixed |
People
(Reporter: karlrapur, Assigned: anna.weine)
Details
Attachments
(1 external file)
Steps to reproduce:
- On a corporate network that blocks UDP egress, so all WebRTC media is forced through a TURN relay over TCP/TLS:443 (both ends relay-only — no host/srflx candidates usable).
- In Firefox 146, placed a 1:1 WebRTC call. The remote party did not answer, so the call should redirect to voicemail — i.e., a renegotiated media leg to a new endpoint.
- Observed the call behavior during the redirect.
- Confirmed it is version-specific: reproduces on 146, not on 145.
- Isolated the cause via
about:configA/B (set pref → restart Firefox → retry the same call on the same network):media.webrtc.send_mlkem_keyshare = false→ call connects ✅media.webrtc.enable_pq_hybrid_kex = false→ call connects ✅
- Captured and decrypted the WebRTC DTLS handshake for both states (
SSLKEYLOGFILEset before launching Firefox; decrypted in Wireshark) to compare theClientHelloon the wire.
Actual results:
The call dropped during the voicemail redirect. ICE connected fine on the relayed path (about:webrtc Connection Log: all checks completed success=1 fail=0, relay↔relay pair nominated), but the new leg's DTLS handshake never completed, so the application tore down the leg and ended the call.
In the decrypted capture, the handshake reaches ServerHello but then stalls:
- The 1461 B
ClientHello(ML-KEM key share, fragmented 1452 + 148 B) is retransmitted ~3× before any response. - After the client sends its final flight (
Certificate, ClientKeyExchange, CertificateVerify, ChangeCipherSpec, Finished), the peer's finalChangeCipherSpec+Finishednever arrives. - The client retransmits its final flight 5× with exponential backoff (50 → 100 → 200 → 400 ms), then gives up — the handshake never reaches
connectedand the call drops.
With the key share disabled, the same call on the same network completes the handshake in ~300 ms and connects normally.
Expected results:
The DTLS handshake should complete over the relayed path (as it does in Firefox 145 and with the key share disabled): the peer returns its final ChangeCipherSpec + Finished, DTLS reaches connected, SRTP media flows, and the call/redirect connects. The default PQ key share should not produce a ClientHello that fails to complete the handshake on constrained/relayed paths.
Comment 1•5 months ago
|
||
Is there any way we could get this payload size down so we're not fragmenting once the packets are transmitted over UDP by a TURN server?
Updated•4 months ago
|
| Assignee | ||
Comment 2•3 months ago
|
||
(In reply to Byron Campen [:bwc] from comment #1)
Is there any way we could get this payload size down so we're not fragmenting once the packets are transmitted over UDP by a TURN server?
We could stop proposing the ml-kem key share during the handshake. We'd still signal support for it in supported_groups, but not eagerly send the key share. If the server insists on PQ, it would then send a HelloRetryRequest asking for an ml-kem key share, costing an extra round trip only in that case.
| Assignee | ||
Comment 3•3 months ago
|
||
This is media.webrtc.send_mlkem_keyshare = false that the reporter shared
Comment 4•3 months ago
|
||
(In reply to Anna Weine from comment #2)
(In reply to Byron Campen [:bwc] from comment #1)
Is there any way we could get this payload size down so we're not fragmenting once the packets are transmitted over UDP by a TURN server?
We could stop proposing the ml-kem key share during the handshake. We'd still signal support for it in supported_groups, but not eagerly send the key share. If the server insists on PQ, it would then send a HelloRetryRequest asking for an ml-kem key share, costing an extra round trip only in that case.
I'm guessing setting media.webrtc.send_mlkem_keyshare to false would disable ml-kem entirely? Or would setting this to false be all we need because it does exactly what you describe here?
| Assignee | ||
Comment 6•3 months ago
|
||
nop, it won't:
StaticPrefs::media_webrtc_enable_pq_hybrid_kex(); disabled PQ (both, we don't advertise nor send key share. See https://searchfox.org/firefox-main/source/dom/media/webrtc/transport/transportlayerdtls.cpp#595)
Only if we have both (https://searchfox.org/firefox-main/source/dom/media/webrtc/transport/transportlayerdtls.cpp#608) we send the long PQ key share
Comment 7•3 months ago
|
||
Ok, so setting StaticPrefs::media_webrtc_send_mlkem_keyshare to false (or, just never doing this) would address this issue? Do you have a preference on whether we pref-flip or just remove the code?
| Assignee | ||
Comment 8•2 months ago
|
||
Updated•2 months ago
|
Updated•2 months ago
|
Comment 10•2 months ago
|
||
| bugherder | ||
Comment 11•2 months ago
|
||
:anna did you want to nominate this for the 158 release notes?
| Assignee | ||
Comment 12•2 months ago
|
||
Frankly I don't think it's worth it, we disabled a feature rather than brought some nice improvement
Updated•2 months ago
|
Description
•