Closed Bug 2047968 Opened 5 months ago Closed 2 months ago

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)

Firefox 146
defect

Tracking

()

RESOLVED FIXED
158 Branch
Tracking Status
firefox158 --- fixed

People

(Reporter: karlrapur, Assigned: anna.weine)

Details

Attachments

(1 external file)

Steps to reproduce:

  1. 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).
  2. 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.
  3. Observed the call behavior during the redirect.
  4. Confirmed it is version-specific: reproduces on 146, not on 145.
  5. Isolated the cause via about:config A/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 ✅
  6. Captured and decrypted the WebRTC DTLS handshake for both states (SSLKEYLOGFILE set before launching Firefox; decrypted in Wireshark) to compare the ClientHello on 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 final ChangeCipherSpec + Finished never arrives.
  • The client retransmits its final flight 5× with exponential backoff (50 → 100 → 200 → 400 ms), then gives up — the handshake never reaches connected and 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.

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?

Flags: needinfo?(anna.weine)
Severity: -- → S3
Priority: -- → P3

(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.

Flags: needinfo?(anna.weine)

This is media.webrtc.send_mlkem_keyshare = false that the reporter shared

(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?

^

Flags: needinfo?(anna.weine)

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

Flags: needinfo?(anna.weine)

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?

Flags: needinfo?(anna.weine)
Assignee: nobody → anna.weine
Attachment #9641928 - Attachment description: WIP: Bug 2047968 - Don't send the ML_KEM key share for WebRTC DTLS by default → Bug 2047968 - Don't send the ML_KEM key share for WebRTC DTLS by default
Status: UNCONFIRMED → ASSIGNED
Ever confirmed: true
Attachment #9641928 - Attachment description: Bug 2047968 - Don't send the ML_KEM key share for WebRTC DTLS by default → Bug 2047968 - Don't send the ML-KEM key share for WebRTC DTLS by default
Status: ASSIGNED → RESOLVED
Closed: 2 months ago
Resolution: --- → FIXED
Target Milestone: --- → 158 Branch

:anna did you want to nominate this for the 158 release notes?

Frankly I don't think it's worth it, we disabled a feature rather than brought some nice improvement

Flags: needinfo?(anna.weine)
QA Whiteboard: [qa-triage-done-c159/b158]
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Creator:
Created:
Updated:
Size: