Tag - Signaling

Securing WebRTC Signaling: How Twinme Encrypts SDPs for Safe Device Connections

By Stephane Carrez

WebRTC has revolutionized real-time communication, enabling everything from video calls to IoT device synchronization. At Twinlife, we use WebRTC to power seamless, low-latency connections between the devices running our applications. But here’s the catch: WebRTC’s signaling phase—where the session descriptions (SDP offers and answers) are exchanged—is often overlooked as a security risk.

Imagine two devices negotiating a connection. The signaling server acts as a matchmaker, relaying session descriptions that contain critical metadata: the DTLS certificate fingerprint, the ICE credentials, the supported codecs and the ICE candidates with their IP addresses. Signaling usually runs over TLS, but the server terminates that TLS connection and sees everything that goes through it. WebRTC encrypts the media streams with DTLS-SRTP, yet the security of DTLS-SRTP rests on one thing: the certificate fingerprint carried in the session description. A server that can read and rewrite the session descriptions can replace the fingerprint and sit in the middle of the media encryption. It can also read the ICE credentials and the private network addresses of the devices.

At Twinlife, we’ve spent a decade hardening our WebRTC implementation. One of our key design choices? Encrypting SDPs before they ever reach the signaling server. Here’s how we do it—and why it matters.

TL;DR Twinlife encrypts WebRTC SDPs end-to-end using per-relation secrets, ensuring signaling servers—even if compromised—cannot read or tamper with connection metadata. Secrets are exchanged via public-key cryptography and rotated regularly, with no modifications to WebRTC itself.

Read more