# Slack DTLS uses a private key that is in the public domain, which may lead to SRTP stream hijack

Slack's Janus WebRTC server used a default DTLS cert+private key from public Janus repo, letting a MITM hijack SRTP media streams.

- Payout: $2,000
- Severity: high
- Program: Slack
- Found by: sandrogauci
- Disclosed: 2020-03-12
- Write-up quality: 7/10
- Original: https://hackerone.com/reports/531032
- Library page: https://bugbountylibrary.com/r/h1%3A531032
- Tags: area:web domain:web impact:data-leak kind:bounty platform:hackerone sev:high tech:websocket technique:recon technique:source-review vuln:crypto vuln:misconfiguration vuln:secrets-leak

**Target:** Slack WebRTC/Janus DTLS endpoint (TURN-tunneled DTLS)
**Root cause:** Janus was deployed with the default DTLS certificate and private key that were publicly distributed in the janus-gateway repo, so the private key is public domain.
**Steps:**
1. Capture STUN with Wireshark filter `stun` during a Slack call
2. Open `about:webrtc-internals` and read `SetRemoteDescription` fingerprint `C5:5F:DA:7D:84:47:B1:BF:6B:55:16:62:48:31:3E:D3:F1:7B:25:89:92:4A:4B:4D:4D:D9:D5:AF:EA:D8:15:44`
3. Fetch default cert/key from janus-gateway commit `6f98f2dde644b3ead4a162c241dff9da1587ec13`
4. Verify fingerprint: `openssl x509 -noout -fingerprint -sha256 -inform pem -in janus-cert1.crt` matches
5. MITM victim's TURN traffic, accept any STUN auth, present the default Janus cert in DTLS, skip verifying victim cert, then control SRTP master key
**How found:** Noticed the DTLS cert string 'rainmaker' in STUN packets, compared the webrtc-internals fingerprint against the default Janus cert removed from the public repo, and confirmed the private key was public.
**Exploitation:** Attacker MITMs victim-to-TURN path (ARP/DNS poisoning or compromised router), impersonates TURN, completes DTLS using the public default cert/key without verifying the victim, and sets the SRTP master key to decrypt/handle the media stream. One-way only due to DTLS mutual auth.
**Insight:** Check whether WebRTC/DTLS endpoints reuse vendor default certs by fingerprinting the SetRemoteDescription value in about:webrtc-internals and matching against upstream repo history where default keys were removed.

## Proof of concept (copied exactly from the original report)

**OpenSSL command computing certificate SHA256 fingerprint**

```
openssl x509 -noout -fingerprint -sha256 -inform pem -in janus-cert1.crt 
SHA256 Fingerprint=C5:5F:DA:7D:84:47:B1:BF:6B:55:16:62:48:31:3E:D3:F1:7B:25:89:92:4A:4B:4D:4D:D9:D5:AF:EA:D8:15:44
```

