networking

Port 3478 STUN/TURN: NAT Traversal, Relay Abuse, and Pentest

Port 3478 STUN/TURN: NAT Traversal, Relay Abuse, and Pentest

Port 3478 STUN/TURN in pentest: NAT traversal, IP leak, NAT type, TURN relay abuse and misconfigurations in WebRTC and VoIP infrastructures.

  • Posted on 2026-04-13
  • Reading time: 3 min

STUN (Session Traversal Utilities for NAT) is a protocol that helps clients behind NAT discover their public IP address and the type of NAT in use. It listens on UDP (and often TCP) port 3478 and is a key component of VoIP, WebRTC, video conferencing, and any peer-to-peer communication that must traverse a NAT. In penetration testing, an exposed STUN server has limited direct value—it provides no access to data or the shell—but it does reveal information about the network topology and, in the case of TURN (its relay extension), can function as an open proxy to tunnel traffic through the target's network.

The distinction is crucial: STUN is just discovery (reveals IP addresses), TURN is relay (forwards traffic). A poorly configured TURN server is an open proxy.

How STUN and TURN Work #

text
Client (LAN)                 STUN/TURN Server (:3478)      Peer
┌────────────┐               ┌───────────────┐             ┌──────┐
│ 192.168.1.5│── Binding ──►│ "Tuo IP       │             │      │
│            │   Request     │  pubblico:    │             │      │
│            │◄── Response ──│  203.0.113.5" │             │      │
│            │               │               │             │      │
│ (TURN)     │── Allocate ──►│  Relay addr   │── relay ──►│      │
│            │◄── relay ─────│  inoltra dati │             │      │
└────────────┘               └───────────────┘             └──────┘

STUN : The client asks, "What's my public IP?" The server responds. Done. TURN : The client asks the server to allocate a relay address and forward the traffic. The server becomes an intermediary—everything passes through it.

Related ports #

PortFunction
3478STUN/TURN standard (UDP/TCP)
3479alternative STUN
5349STUN/TURN over TLS
443TURN over TLS (firewall bypass)

1. Enumeration #

Nmap #

bash
nmap -sU -sT -p 3478 10.10.10.40
text
PORT     STATE SERVICE
3478/udp open  stun
3478/tcp open  stun

STUN binding request #

bash
stun 10.10.10.40 3478
text
STUN client version 0.97
Primary:
  Mapped address: 203.0.113.5:54321
  Binding test: success
  NAT type: Full Cone

Intelligence: Your public IP as seen by the server, NAT type (Full Cone = permissive).

TURN test — the real target #

bash
# Con turnutils_uclient (da coturn)
turnutils_uclient -t -T 10.10.10.40 -p 3478 -u testuser -w testpass

If you connect without credentials → open TURN relay.

bash
# Test senza credenziali
turnutils_uclient -t 10.10.10.40 -p 3478

2. TURN Misconfiguration — Open Relay #

An unauthenticated TURN is an open relay: it tunnels any TCP/UDP traffic through the target network.

What can you do with an open TURN relay? #

  • Scanning the target's internal network through the relay
  • Traffic anonymization (the target sees the TURN IP, not yours)
  • Bypass firewall — TURN is in the internal network
  • Access to unexposed internal services

Tunneling via TURN #

bash
# stunner: crea SOCKS5 proxy via TURN
stunner turn://10.10.10.40:3478 -u user -p pass socks5://127.0.0.1:1080
bash
# Proxychains attraverso il tunnel
proxychains nmap -sT -Pn 10.10.10.0/24

TURN Credentials in Frontend JavaScript #

WebRTC applications often hardcode TURN credentials into client-side code:

bash
curl -s http://target.com/ | grep -iE "turn:|stun:|credential|iceServers"
javascript
// Comune trovare:
iceServers: [{
    urls: "turn:10.10.10.40:3478",
    username: "webrtc_user",
    credential: "WebRTC_P@ss!"
}]

Clear text credentials in JavaScript — visible to anyone viewing the page.

3. Detection & Hardening #

  • TURN with mandatory authentication — never without credentials
  • Temporary tokens backend generated — don't hardcode in the frontend
  • Rate limiting on TURN allocations
  • Limit relay destinations — block relay to internal network
  • Firewall — port 3478 for authorized clients only
  • Monitor abnormal traffic volumes and allocations from unknown IPs

4. Final Cheat Sheet #

ActionCommand
Nmapnmap -sU -sT -p 3478 target
STUN bindingstun target 3478
TURN testturnutils_uclient -t target -p 3478
TURN with credsturnutils_uclient -t target -p 3478 -u user -w pass
Search WebRTC credscurl -s http://target/ | grep -i "turn:|credential"
TURN → SOCKSstunner turn://target:3478 socks5://127.0.0.1:1080
proxychainsproxychains nmap -sT -Pn internal_subnet

Reference: RFC 5389 (STUN), RFC 5766 (TURN), WebRTC security. For use in authorized environments only. https://medium.com/@jamesbordane57/stun-protocol-port-and-traffic-ab96f8f6cf5e

hackita.it/supporto — hackita.it/servizi.

#STUN #TURN Relay #WebRTC

leave a message

I'm not a robot