Skip to content
Crypto Disclosed report Advanced

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

Slack's WebRTC calls used a DTLS certificate and private key that were previously published in the Janus open-source project, so the key is effectively public. An attacker in a man-in-the-middle position could present that certificate to a victim's client and take over the SRTP media stream, though the text says a full two-way interception does not appear possible.

Sandro Gauci Follow

Originally disclosed on HackerOne

Bounty$2,000 High 8.7 View original
  • Triaged in 8 hours
  • Fixed in 45 days
  • Paid in 45 days
  • Disclosed after 11 months

Summary by the researcher

DTLS certificate used for Slack WebRTC calls was previously included in the Janus (WebRTC server) together with the private key, thus considered public domain.

The report

  • Affects: Janus DTLS certificate

Description

The Janus server in use by Slack is configured using a certificate and private key that were previously distributed by default. This certificate is used to authenticate the DTLS connection which is later used to exchange keys for the SRTP stream. As a result, the confidentiality of the WebRTC call over Slack cannot be ensured.

How to reproduce the issue

  1. Start Wireshark and set a display filter for stun
  2. In the web browser, open about:webrtc-internals
  3. Start a call on Slack
  4. Observe the packets containing the string rainmaker which would be part of the DTLS certificate
  5. Notice that the SetRemoteDescription fingerprint in the about:webrtc-internals page is 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

The old certificate can be obtained from the following commit where it was previously removed:

https://github.com/meetecho/janus-gateway/commit/6f98f2dde644b3ead4a162c241dff9da1587ec13

The certificate's SHA256 checksum can be calculated using the OpenSSL command line tool as follows:

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

Attachments:

  • dump-stun.pcapng: contains the data stream containing the TURN tunnelled DTLS exchange and SRTP stream that follows
  • janus-cert1.crt and janus-cert1.key are the certificate and key in use by Slack
  • 2019-04-07_16-06-wireshark.png shows the certificate in the Wireshark dump
  • 2019-04-07_16-13-fingerprint.png shows the SHA256 fingerprint which matches the public certificate and corresponding private key

An attacker would probably need to take the following steps to exploit this issue in the case of Slack:

  1. Start a man-in-the-middle attack using any known method (ARP cache poisoning, DNS cache poisoning, static routes on compromised network router etc)
  2. Actively hijack the Slack TURN servers between the victim and the Internet
  3. Wait for victim to make a Slack call
  4. Handle STUN packets from victim to attacker-controlled TURN server; allow authentication with any password
  5. Start DTLS exchange
  6. When DTLS certificate is required, present victim with the Janus default certificate
  7. The attacker does NOT verify the victim's DTLS certificate
  8. The SRTP Master Key is set over this DTLS connection
  9. Attacker can now handle the SRTP stream between the victim and attacker

Solutions and recommendations

It is recommended to generate a new certificate and private key.

Impact

Attackers positioned as man-in-the-middle may hijack the DTLS connection and set their own SRTP keys, handling the SRTP stream instead of Slack. This is still research in progress but it does not appear that attackers can perform a two-way MITM attack due to the mutual authentication required by the DTLS exchange. Therefore, it seems that this vulnerability can only be abused to hijack the SRTP stream between the WebRTC client and Slack but not the other way round.

Attachments

2019-04-07_16-13-fingerprint.png
2019-04-07_16-13-fingerprint.png From the original on HackerOne
2019-04-07_16-06-wireshark.png
2019-04-07_16-06-wireshark.png

The original report as published on HackerOne, by sandrogauci. Images and videos are our own copies; raw HTML is shown as text. View it on HackerOne.

Not written yet. The AI write-up for this report has not been written yet. The Original tab links to the source.

How it worked

Root cause

Likely the Slack deployment reused a default DTLS certificate and private key that had been published with the Janus project instead of generating its own unique pair.

Impact

An attacker positioned as a man-in-the-middle may hijack the DTLS connection and set their own SRTP keys, handling the SRTP stream instead of Slack; the text says a two-way MITM does not appear possible because of mutual authentication.

What the attacker needed

Attacker can man-in-the-middle the network; victim starts a Slack call; attacker controls or hijacks the TURN path

The fix

A new certificate and private key should be generated so the deployment no longer relies on a publicly known key pair.

How it was found

  1. Start Wireshark and filter for STUN traffic.
  2. Open the browser's WebRTC internals page.
  3. Start a Slack call.
  4. Look for packets containing the certificate's identifying string.
  5. Compare the remote description fingerprint shown in the browser with the known public certificate fingerprint.

Explained by bugbounty.wiki with AI from the original and checked against quotes from it; it can still be wrong. Read the original before relying on a detail.

Not written yet. The AI write-up for this report has not been written yet. The Original tab links to the source.

WebRTC calls use a handshake called DTLS to agree on encryption keys, and each side proves who it is with a certificate. If the private key behind that certificate is public, anyone can pretend to be the server. Here Slack reused a certificate whose private key had been shipped with an open-source project, so someone who can sit between you and Slack could impersonate the call server and read or replace the media stream.

What is Crypto?

Encryption, signatures, randomness or certificate checks that do not protect what they claim to.

More by Sandro Gauci

View all

3 more disclosed reports, best first.

More from Slack

View all

The newest disclosed reports for this program.

Similar reports

View all

Same bug class and techniques, clearest first.

Cryptographic weaknesses

The lesson behind this report.

Encryption, signatures, randomness or certificate checks that do not protect what they claim to.