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 #
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 #
| Port | Function |
|---|---|
| 3478 | STUN/TURN standard (UDP/TCP) |
| 3479 | alternative STUN |
| 5349 | STUN/TURN over TLS |
| 443 | TURN over TLS (firewall bypass) |
1. Enumeration #
Nmap #
nmap -sU -sT -p 3478 10.10.10.40PORT STATE SERVICE
3478/udp open stun
3478/tcp open stunSTUN binding request #
stun 10.10.10.40 3478STUN client version 0.97
Primary:
Mapped address: 203.0.113.5:54321
Binding test: success
NAT type: Full ConeIntelligence: Your public IP as seen by the server, NAT type (Full Cone = permissive).
TURN test — the real target #
# Con turnutils_uclient (da coturn)
turnutils_uclient -t -T 10.10.10.40 -p 3478 -u testuser -w testpassIf you connect without credentials → open TURN relay.
# Test senza credenziali
turnutils_uclient -t 10.10.10.40 -p 34782. 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 #
# stunner: crea SOCKS5 proxy via TURN
stunner turn://10.10.10.40:3478 -u user -p pass socks5://127.0.0.1:1080# Proxychains attraverso il tunnel
proxychains nmap -sT -Pn 10.10.10.0/24TURN Credentials in Frontend JavaScript #
WebRTC applications often hardcode TURN credentials into client-side code:
curl -s http://target.com/ | grep -iE "turn:|stun:|credential|iceServers"// 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 #
| Action | Command |
|---|---|
| Nmap | nmap -sU -sT -p 3478 target |
| STUN binding | stun target 3478 |
| TURN test | turnutils_uclient -t target -p 3478 |
| TURN with creds | turnutils_uclient -t target -p 3478 -u user -w pass |
| Search WebRTC creds | curl -s http://target/ | grep -i "turn:|credential" |
| TURN → SOCKS | stunner turn://target:3478 socks5://127.0.0.1:1080 |
| proxychains | proxychains 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








