Skip to content

Commit 26a8c78

Browse files
committed
update
1 parent f595160 commit 26a8c78

File tree

9 files changed

+128
-55
lines changed

9 files changed

+128
-55
lines changed

.github/workflows/codeql.yml

+28-28
Original file line numberDiff line numberDiff line change
@@ -37,38 +37,38 @@ jobs:
3737
# Learn more about CodeQL language support at https://git.io/codeql-language-support
3838

3939
steps:
40-
- name: Checkout repository
41-
uses: actions/checkout@v4
40+
- name: Checkout repository
41+
uses: actions/checkout@v4
4242

43-
- uses: actions/setup-go@v5
44-
with:
45-
go-version: "stable"
43+
- uses: actions/setup-go@v5
44+
with:
45+
go-version: "stable"
4646

47-
# Initializes the CodeQL tools for scanning.
48-
- name: Initialize CodeQL
49-
uses: github/codeql-action/init@v3
50-
with:
51-
languages: ${{ matrix.language }}
52-
# If you wish to specify custom queries, you can do so here or in a config file.
53-
# By default, queries listed here will override any specified in a config file.
54-
# Prefix the list here with "+" to use these queries and those in the config file.
55-
# queries: ./path/to/local/query, your-org/your-repo/queries@main
47+
# Initializes the CodeQL tools for scanning.
48+
- name: Initialize CodeQL
49+
uses: github/codeql-action/init@v3
50+
with:
51+
languages: ${{ matrix.language }}
52+
# If you wish to specify custom queries, you can do so here or in a config file.
53+
# By default, queries listed here will override any specified in a config file.
54+
# Prefix the list here with "+" to use these queries and those in the config file.
55+
# queries: ./path/to/local/query, your-org/your-repo/queries@main
5656

57-
# Autobuild attempts to build any compiled languages (C/C++, C#, or Java).
58-
# If this step fails, then you should remove it and run the build manually (see below)
59-
- name: Autobuild
60-
uses: github/codeql-action/autobuild@v3
57+
# Autobuild attempts to build any compiled languages (C/C++, C#, or Java).
58+
# If this step fails, then you should remove it and run the build manually (see below)
59+
- name: Autobuild
60+
uses: github/codeql-action/autobuild@v3
6161

62-
# ℹ️ Command-line programs to run using the OS shell.
63-
# 📚 https://git.io/JvXDl
62+
# ℹ️ Command-line programs to run using the OS shell.
63+
# 📚 https://git.io/JvXDl
6464

65-
# ✏️ If the Autobuild fails above, remove it and uncomment the following three lines
66-
# and modify them (or add more) to build your code if your project
67-
# uses a compiled language
65+
# ✏️ If the Autobuild fails above, remove it and uncomment the following three lines
66+
# and modify them (or add more) to build your code if your project
67+
# uses a compiled language
6868

69-
#- run: |
70-
# make bootstrap
71-
# make release
69+
#- run: |
70+
# make bootstrap
71+
# make release
7272

73-
- name: Perform CodeQL Analysis
74-
uses: github/codeql-action/analyze@v3
73+
- name: Perform CodeQL Analysis
74+
uses: github/codeql-action/analyze@v3

.github/workflows/go.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
name: Go
2-
on: [push, pull_request]
2+
on: [ push, pull_request ]
33
jobs:
44
build:
55
name: Build

.github/workflows/golangci-lint.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
name: golangci-lint
2-
on: [push, workflow_dispatch]
2+
on: [ push, workflow_dispatch ]
33
jobs:
44
golangci:
55
name: lint

.idea/.gitignore

+8
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

.idea/modules.xml

+8
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

.idea/stunner.iml

+9
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

.idea/vcs.xml

+6
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Readme.md

+66-24
Original file line numberDiff line numberDiff line change
@@ -3,15 +3,21 @@
33
Stunner is a tool to test and exploit STUN, TURN and TURN over TCP servers.
44
TURN is a protocol mostly used in videoconferencing and audio chats (WebRTC).
55

6-
If you find a misconfigured server you can use this tool to open a local socks proxy that relays all traffic via the TURN protocol into the internal network behind the server.
6+
If you find a misconfigured server you can use this tool to open a local socks proxy that relays all traffic via the
7+
TURN protocol into the internal network behind the server.
78

8-
I developed this tool during a test of Cisco Expressway which resulted in some vulnerabilities: [https://firefart.at/post/multiple_vulnerabilities_cisco_expressway/](https://firefart.at/post/multiple_vulnerabilities_cisco_expressway/)
9+
I developed this tool during a test of Cisco Expressway which resulted in some
10+
vulnerabilities: [https://firefart.at/post/multiple_vulnerabilities_cisco_expressway/](https://firefart.at/post/multiple_vulnerabilities_cisco_expressway/)
911

10-
To get the required username and password you need to fetch them using an out-of-band method like sniffing the Connect request from a web browser with Burp. I added an [example workflow](#example-workflow) at the bottom of the readme on how you would test such a server.
12+
To get the required username and password you need to fetch them using an out-of-band method like sniffing the Connect
13+
request from a web browser with Burp. I added an [example workflow](#example-workflow) at the bottom of the readme on
14+
how you would test such a server.
1115

1216
# LICENSE
1317

14-
This work is licensed under the Creative Commons Attribution-NonCommercial-ShareAlike 4.0 International License. To view a copy of this license, visit http://creativecommons.org/licenses/by-nc-sa/4.0/ or send a letter to Creative Commons, PO Box 1866, Mountain View, CA 94042, USA.
18+
This work is licensed under the Creative Commons Attribution-NonCommercial-ShareAlike 4.0 International License. To view
19+
a copy of this license, visit http://creativecommons.org/licenses/by-nc-sa/4.0/ or send a letter to Creative Commons, PO
20+
Box 1866, Mountain View, CA 94042, USA.
1521

1622
# implemented RFCs
1723

@@ -27,7 +33,8 @@ TURN Extension for IPv6: [RFC 6156](https://datatracker.ietf.org/doc/html/rfc615
2733

2834
## info
2935

30-
This command will print some info about the stun or turn server like supported protocols and attributes like the used software.
36+
This command will print some info about the stun or turn server like supported protocols and attributes like the used
37+
software.
3138

3239
### Options
3340

@@ -47,7 +54,9 @@ This command will print some info about the stun or turn server like supported p
4754

4855
## range-scan
4956

50-
This command tries several private and restricted ranges to see if the TURN server is configured to allow connections to the specified IP addresses. If a specific range is not prohibited you can enumerate this range further with the other provided commands. If an ip is reachable it means the TURN server will forward traffic to this IP.
57+
This command tries several private and restricted ranges to see if the TURN server is configured to allow connections to
58+
the specified IP addresses. If a specific range is not prohibited you can enumerate this range further with the other
59+
provided commands. If an ip is reachable it means the TURN server will forward traffic to this IP.
5160

5261
### Options
5362

@@ -78,7 +87,12 @@ UDP based TURN connection (connection from you the TURN server):
7887

7988
## socks
8089

81-
This is one of the most useful commands for TURN servers that support TCP connections to backend servers. It will launch a local socks5 server with no authentication and will relay all TCP traffic over the TURN protocol (UDP via SOCKS is currently not supported). If the server is misconfuigured it will forward the traffic to internal adresses so this can be used to reach internal systems and abuse the server as a proxy into the internal network. If you choose to also do DNS lookups over socks, it will be resolved using your local nameserver so it's best to work with private IPv4 and IPv6 addresses. Please be aware that this module can only relay TCP traffic.
90+
This is one of the most useful commands for TURN servers that support TCP connections to backend servers. It will launch
91+
a local socks5 server with no authentication and will relay all TCP traffic over the TURN protocol (UDP via SOCKS is
92+
currently not supported). If the server is misconfuigured it will forward the traffic to internal adresses so this can
93+
be used to reach internal systems and abuse the server as a proxy into the internal network. If you choose to also do
94+
DNS lookups over socks, it will be resolved using your local nameserver so it's best to work with private IPv4 and IPv6
95+
addresses. Please be aware that this module can only relay TCP traffic.
8296

8397
### Options
8498

@@ -101,21 +115,29 @@ This is one of the most useful commands for TURN servers that support TCP connec
101115
./stunner socks -s x.x.x.x:3478 -u username -p password -x
102116
```
103117

104-
After starting the proxy open your browser, point the proxy in your settings to socks5 with an ip of 127.0.0.1:1080 (be sure to not set the bypass local address option as we want to reach the remote local addresses) and call the IP of your choice in the browser.
118+
After starting the proxy open your browser, point the proxy in your settings to socks5 with an ip of 127.0.0.1:1080 (be
119+
sure to not set the bypass local address option as we want to reach the remote local addresses) and call the IP of your
120+
choice in the browser.
105121

106-
Example: https://127.0.0.1, https://127.0.0.1:8443 or https://[::1]:8443 (those will call the ports on the tested TURN server from the local interfaces).
122+
Example: https://127.0.0.1, https://127.0.0.1:8443 or https://[::1]:8443 (those will call the ports on the tested TURN
123+
server from the local interfaces).
107124

108-
You can also configure `proxychains` to use this proxy (but it will be very slow as each request results in multiple requests to enable the proxying). Just edit `/etc/proxychains.conf` and enter the value `socks5 127.0.0.1 1080` under `ProxyList`.
125+
You can also configure `proxychains` to use this proxy (but it will be very slow as each request results in multiple
126+
requests to enable the proxying). Just edit `/etc/proxychains.conf` and enter the value `socks5 127.0.0.1 1080` under
127+
`ProxyList`.
109128

110-
Example of nmap over this socks5 proxy with a correct configured proxychains (note it's -sT to do TCP syns otherwise it will not use the socks5 proxy)
129+
Example of nmap over this socks5 proxy with a correct configured proxychains (note it's -sT to do TCP syns otherwise it
130+
will not use the socks5 proxy)
111131

112132
```bash
113133
sudo proxychains nmap -sT -p 80,443,8443 -sV 127.0.0.1
114134
```
115135

116136
## brute-transports
117137

118-
This will most likely yield no useable information but can be useful to enumerate all available transports (=protocols to internal systems) supported by the server. This might show some custom protocol implementations but mostly will only return the defaults.
138+
This will most likely yield no useable information but can be useful to enumerate all available transports (=protocols
139+
to internal systems) supported by the server. This might show some custom protocol implementations but mostly will only
140+
return the defaults.
119141

120142
### Options
121143

@@ -138,7 +160,8 @@ This will most likely yield no useable information but can be useful to enumerat
138160

139161
## brute-password
140162

141-
This command tries all passwords from a given file for a username via the TURN protocol (UDP). This can be useful when analysing a pcap where you can see the username but not the password.
163+
This command tries all passwords from a given file for a username via the TURN protocol (UDP). This can be useful when
164+
analysing a pcap where you can see the username but not the password.
142165
Please note that an offline bruteforce is much more faster in this case.
143166

144167
### Options
@@ -163,7 +186,10 @@ Please note that an offline bruteforce is much more faster in this case.
163186
## memoryleak
164187

165188
This attack works the following way:
166-
The server takes the data to send to `target` (must be a high port > 1024 in most cases) as a TLV (Type Length Value). This exploit uses a big length with a short value. If the server does not check the boundaries of the TLV, it might send you some memory up the `length` to the `target`. Cisco Expressway was confirmed vulnerable to this but according to cisco it only leaked memory of the current session.
189+
The server takes the data to send to `target` (must be a high port > 1024 in most cases) as a TLV (Type Length Value).
190+
This exploit uses a big length with a short value. If the server does not check the boundaries of the TLV, it might send
191+
you some memory up the `length` to the `target`. Cisco Expressway was confirmed vulnerable to this but according to
192+
cisco it only leaked memory of the current session.
167193

168194
### Options
169195

@@ -182,8 +208,9 @@ The server takes the data to send to `target` (must be a high port > 1024 in mos
182208

183209
### Example
184210

185-
To receive the data we need to set up a receiver on a server with a public ip. Normally firewalls are configured to only allow highports (>1024) from TURN servers so be sure to use a high port like 8080 in this example when connecting out to the internet.
186-
211+
To receive the data we need to set up a receiver on a server with a public ip. Normally firewalls are configured to only
212+
allow highports (>1024) from TURN servers so be sure to use a high port like 8080 in this example when connecting out to
213+
the internet.
187214

188215
```bash
189216
sudo nc -u -l -n -v -p 8080 | hexdump -C
@@ -199,7 +226,10 @@ If it works you should see big loads of memory coming in, otherwise you will onl
199226

200227
## udp-scanner
201228

202-
If a TURN server allows UDP connections to targets this scanner can be used to scan all private ip ranges and send them SNMP and DNS requests. As this checks a lot of IPs this can take multiple days to complete so use with caution or specify smaller targets via the parameters. You need to supply a SNMP community string that will be tried and a domain name that will be resolved on each IP. For the domain name you can for example use burp collaborator.
229+
If a TURN server allows UDP connections to targets this scanner can be used to scan all private ip ranges and send them
230+
SNMP and DNS requests. As this checks a lot of IPs this can take multiple days to complete so use with caution or
231+
specify smaller targets via the parameters. You need to supply a SNMP community string that will be tried and a domain
232+
name that will be resolved on each IP. For the domain name you can for example use burp collaborator.
203233

204234
### Options
205235

@@ -252,10 +282,22 @@ Same as `udp-scanner` but sends out HTTP requests to the specified ports (HTTPS
252282

253283
Let's say you find a service using WebRTC and want to test it.
254284

255-
First step is to get the required data. I suggest to launch Wireshark in the background and just join a meeting via Burp to collect all HTTP and Websocket traffic. Next search your burp history for some keywords related to TURN like `3478`, `password`, `credential` and `username` (be sure to also check the websocket tab for these keywords). This might reveal the turn server and the protocol (UDP and TCP endpoints might have different ports) and the credentials used to connect. If you can't find the data in burp start looking at wireshark to identify the traffic. If it's on a non standard port (anything else then 3478) decode the protocol in Wireshark via a right click as `STUN`. This should show you the username used to connect and you can use this information to search burps history even further for the required data. Please note that Wireshark can't show you the password as the password is used to hash some package contents so it can not be reversed.
256-
257-
Next step would be to issue the `info` command to the turn server using the correct port and protocol obtained from burp.
258-
259-
If this works, the next step is a `range-scan`. If this allows any traffic to internal systems you can exploit this further but be aware that UDP has only limited use cases.
260-
261-
If TCP connections to internal systems are allowed simply launch the `socks` command and access the allowed IPs via a browser and set the socks proxy to 127.0.0.1:1080. You can try out 127.0.0.1:443 and other ips to find management interfaces.
285+
First step is to get the required data. I suggest to launch Wireshark in the background and just join a meeting via Burp
286+
to collect all HTTP and Websocket traffic. Next search your burp history for some keywords related to TURN like `3478`,
287+
`password`, `credential` and `username` (be sure to also check the websocket tab for these keywords). This might reveal
288+
the turn server and the protocol (UDP and TCP endpoints might have different ports) and the credentials used to connect.
289+
If you can't find the data in burp start looking at wireshark to identify the traffic. If it's on a non standard port (
290+
anything else then 3478) decode the protocol in Wireshark via a right click as `STUN`. This should show you the username
291+
used to connect and you can use this information to search burps history even further for the required data. Please note
292+
that Wireshark can't show you the password as the password is used to hash some package contents so it can not be
293+
reversed.
294+
295+
Next step would be to issue the `info` command to the turn server using the correct port and protocol obtained from
296+
burp.
297+
298+
If this works, the next step is a `range-scan`. If this allows any traffic to internal systems you can exploit this
299+
further but be aware that UDP has only limited use cases.
300+
301+
If TCP connections to internal systems are allowed simply launch the `socks` command and access the allowed IPs via a
302+
browser and set the socks proxy to 127.0.0.1:1080. You can try out 127.0.0.1:443 and other ips to find management
303+
interfaces.

Taskfile.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ tasks:
1313
- go mod tidy -v
1414

1515
build:
16-
aliases: [default]
16+
aliases: [ default ]
1717
cmds:
1818
- go fmt ./...
1919
- go vet ./...

0 commit comments

Comments
 (0)