Sniffing Voip Calls Using Raspberry Pi Vighnesh Raje (@S3Curityg33K)
Sniffing Voip Calls Using Raspberry Pi Vighnesh Raje (@S3Curityg33K)
Sniffing Voip Calls Using Raspberry Pi Vighnesh Raje (@S3Curityg33K)
PG. 1
Sniffing VoIP calls using Raspberry pi Vighnesh Raje (@s3curityg33k)
Table of Contents
1. Abstract ......................................................................................................................................... 3
2. Literature Review .......................................................................................................................... 4
3. Introduction ................................................................................................................................... 5
3.1 VoIP Packets ........................................................................................................................... 5
4. Lab Configuration ......................................................................................................................... 7
4.1 Asterisk Configuration ............................................................................................................. 8
1.2 Configuring Zoiper Softphone................................................................................................ 14
5. Configuring Raspberry pi ............................................................................................................ 17
5.1 Remote Log into Raspberry Pi’s Full Operating System Using VNC Connect ........................ 24
5.2 Installing Required Packages ................................................................................................. 25
6. Sniffing VoIP calls using custom script over a Raspberry pi ......................................................... 26
7. Conclusion .................................................................................................................................. 31
8. References ................................................................................................................................... 32
PG. 2
Sniffing VoIP calls using Raspberry pi Vighnesh Raje (@s3curityg33k)
1. Abstract
Voice over Internet Protocol (VoIP), is a technology that allows you to make voice calls using
a broadband Internet connection instead of a regular (or analog) phone line.
Because of the bandwidth efficiency and low costs that VoIP technology can provide,
businesses are migrating from traditional copper-wire telephone systems to VoIP systems to
reduce their monthly phone costs. In 2008, 80% of all new Private branch exchange (PBX)
lines installed internationally were VoIP[1].
The use of Voice Over Internet Protocol (VOIP) calls by criminals, have proved to be a
hindrance in its investigations. The first use of VOIP calls was seen during the 26/11 terror
attacks of 2008 and, since then, the practice has become alarmingly common among criminals,
especially underworld elements who operate from outside the country[2].
This project aims at using the compactness and portability of raspberry pi for intercepting VoIP
calls for investigative purposes.
PG. 3
Sniffing VoIP calls using Raspberry pi Vighnesh Raje (@s3curityg33k)
2. Literature Review
As being an old concept, sufficient research is done on VoIP technology, security and forensics.
Some of the relevant articles are cited here. Researcher Rakesh Arora have worked on
understanding protocols and standards used in VoIP implementation[3] while Sohil Garg have
worked on possible attacks on VoIP infrastructure[4]. Solutions have been proposed for the
possible attacks vectors[5] by Santi Phithakkitnukoon, Enkh-Amgalan Baatarjav, Ram Dantu.
Also efficient research has also been done on the forensic aspects of VoIP[6][7]. However,
different researchers worked on enhancing security and forensics practice for VoIP attacks, no
researcher has worked on sniffing VoIP call over a portable, robust, compact standalone device
like a raspberry pi. This project focuses on the above mentioned untouched aspect in VoIP
forensics.
PG. 4
Sniffing VoIP calls using Raspberry pi Vighnesh Raje (@s3curityg33k)
3. Introduction
VoIP known as IP Telephony is the real-time transmission of voice signals to the Internet
Protocol (IP) over the public Internet or a private data network. VoIP converts the voice signal
from telephone into a digital signal that travels over the Internet. most important advantages of
VoIP are that one can make a long distance phone call and bypass the toll charge. This
integrated voice/data solution allows large organizations to carry voice applications over their
existing data networks. Not only will this technological advancement have an impact on the
large traditional telecommunications industry, it will alter the pricing and cost structures of
traditional telephony (over a traditional public switched telephone network (PSTN - also
known as a legacy networks). IP networks can carry 5 to 10 times the number of voice calls
over the same bandwidth. However, through IP networks to transmit voice and other
information, VoIP has inherited the security issues of Internet Protocol networks. As by default
the Internet Protocol networks are not encrypted, the underlying VoIP calls are made in plain
text. Though is a major security flaw, it is also a bone for a forensic expert as he can sniff and
intercept the calls.
The procedures, elements and protocols specified by the H.323 standard that provides
multimedia communication across packet-based networks. Multipoint multimedia or Point-to-
point communication services is being provided by H.323 system when its four main elements
Multipoint.
SIP
SIP (Session initiation protocol) is a communication protocol used for signalling and
controlling multimedia communication sessions such as online gaming, instant messaging and
various services. It is similar to web protocol HTTP since messages comprises of headers and
a message body. SIP generally uses port 5060 as its default protocol for either TCP or UDP.
SIP can be interpreted as the authorize protocol for voice, telephony and video over IP (VoIP)
services.
MGCP is a protocol for handling telephony and VoIP gateways from external network call
control devices called Call Agents. The MGCP protocol assumes call control devices or Call
PG. 5
Sniffing VoIP calls using Raspberry pi Vighnesh Raje (@s3curityg33k)
Agents, establish with each other to send commands to the they control. Call Agents also
connect directly to IP Phones. The Media Gateways or IP Phones are run commands sent by
the Call Agents. The figure shows the MGCP elements and call control actions.
RTP
RTP is using for real-time stream data transfer over the network. It allows data transfer to
multiple destinations using IP and treated as primary protocol for audio/video transport within
IP networks. RTP is used with a signalling protocol that assists in build-up connections across
the network. The RTP protocol is useful for audio and video streaming. Two RTP sessions
establishes for video streaming and each with different SSRC identifiers out of which one is
useful for audio transmission whereas another for video transmission. Also, there is downside
of RTP that it neither assures delivery of packets nor Quality of Service.
PG. 6
Sniffing VoIP calls using Raspberry pi Vighnesh Raje (@s3curityg33k)
4. Lab Configuration
For the scope of this research, the following lab scenario is being considered:
• Router
Network: 192.168.0.100
Zoiper Softphone 1
PG. 7
Sniffing VoIP calls using Raspberry pi Vighnesh Raje (@s3curityg33k)
Zoiper Softphone 2
Today, there are more than one million Asterisk-based communications systems in use, in more
than 170 countries. Asterisk is used by almost the entire Fortune 1000 list of customers. [9]
Setup
Begin with creating a virtual machine 3 GB RAM, 50 GB Hard Disk space and 1 processor
CPU.
Later, move inside Settings -> Storage -> Controller: IDE -> Add Asterisk ISO image.
Now, move inside network settings and set the adapter to “Bridge Adapter”.
Once configuration will be completed, the system will reboot. Once rebooted user will be
greeted with following screen.
PG. 8
Sniffing VoIP calls using Raspberry pi Vighnesh Raje (@s3curityg33k)
Inside a web browser, traverse to the asterisk server IP address. User will be prompted to setup
user account. Enter the required details.
PG. 9
Sniffing VoIP calls using Raspberry pi Vighnesh Raje (@s3curityg33k)
Activate FreePBX.
PG. 10
Sniffing VoIP calls using Raspberry pi Vighnesh Raje (@s3curityg33k)
PG. 11
Sniffing VoIP calls using Raspberry pi Vighnesh Raje (@s3curityg33k)
PG. 12
Sniffing VoIP calls using Raspberry pi Vighnesh Raje (@s3curityg33k)
Provide with details like, User Extension, Display Name and Secret.
PG. 13
Sniffing VoIP calls using Raspberry pi Vighnesh Raje (@s3curityg33k)
Zoiper, the free softphone to make VoIP calls through your PBX or favourite SIP provider.
Available for iPhone, Android, Windows Phone 8, Windows, Mac.
Note: Here, we are considering the system to be on same network as that of VoIP server.
Install the downloaded Zoiper executable. After installation, launch the application. Provide
with User Extension and password.
PG. 14
Sniffing VoIP calls using Raspberry pi Vighnesh Raje (@s3curityg33k)
PG. 15
Sniffing VoIP calls using Raspberry pi Vighnesh Raje (@s3curityg33k)
PG. 16
Sniffing VoIP calls using Raspberry pi Vighnesh Raje (@s3curityg33k)
5. Configuring Raspberry pi
For the scope of this project we will be working on Raspberry Pi Model 3.
The Raspberry Pi 3 Model B is the earliest model of the third-generation Raspberry Pi. It
replaced the Raspberry Pi 2 Model B in February 2016. See also the Raspberry Pi 3 Model B+,
the latest product in the Raspberry Pi 3 range. [11]
User must flash Kali Linux for ARM OS. Let’s begin with downloading the kali image file
from here.
PG. 17
Sniffing VoIP calls using Raspberry pi Vighnesh Raje (@s3curityg33k)
After formatting the SD card, flash the image inside it. For that launch Balena Etcher software
and follow the steps from the screen shot. Balena Etcher can be downloaded from
https://www.balena.io/etcher/.
PG. 18
Sniffing VoIP calls using Raspberry pi Vighnesh Raje (@s3curityg33k)
After flashing the SD card, insert SD card inside raspberry pi and power it on.
Now we will be connecting the raspberry pie with the network, so that latter we can SSH into
the pie.
For that, inside your desktop go to Network Sharing centre and choose Wi-Fi.
Now, go to Properties -> Sharing and check the “Allow other network users to connect”
checkbox. In “Home networking connection” choose Ethernet. Click “OK” to save the settings.
PG. 19
Sniffing VoIP calls using Raspberry pi Vighnesh Raje (@s3curityg33k)
Now, go to “Details” and notice the IPv4 Address. Here, its 192.168.137.1 which will act as a
gateway for our pi.
PG. 20
Sniffing VoIP calls using Raspberry pi Vighnesh Raje (@s3curityg33k)
Now for finding the IP address of raspberry pi, run advance in scanner on the IP range we
found above (Ethernet settings).
PG. 21
Sniffing VoIP calls using Raspberry pi Vighnesh Raje (@s3curityg33k)
Proceed by entering login credentials. The default user for raspbian OS is “pi” and password
is “raspbian”.
Connect an additional USB Wi-Fi adapter to raspberry pi. After that user must configure the
network settings. For that run the command:
$ nmtui
User will be prompted with a text menu. Move to “Edit Connection” -> “Add Connection” ->
“Wi-Fi”. Provide details like SSID, Security Type, Password. Here static IP is configured.
PG. 22
Sniffing VoIP calls using Raspberry pi Vighnesh Raje (@s3curityg33k)
Note: As static IP is set, the two Wi-Fi connections, even though have same SSID, must have
different static IPs set.
Configure Wi-Fi adapter and USB Wi-Fi adapter with these connections respectively.
$ ifconfig
PG. 23
Sniffing VoIP calls using Raspberry pi Vighnesh Raje (@s3curityg33k)
5.1 Remote Log into Raspberry Pi’s Full Operating System Using VNC Connect
VNC has been the best way to access any computer remotely on the same network. Recently,
VNC Connect also came out to make it easy to access your Raspberry Pi from anywhere using
a cloud connection. Once it’s set up, you can access your Raspberry Pi’s graphic interface from
any other computer or smartphone using the VNC Viewer app.
VNC Connect comes packed in for free with the most recent versions of the Raspberry Pi
operating system. [12]
VNC can be set up in few simple steps. Open up a terminal and run the following commands:
$ sudo raspi-config
• Head to the RealVNC Raspberry Pi sign up page and enter your email address in the
sign up box.
• Follow the on-screen instructions to finish setting up your account with a password.
• Back on your Raspberry Pi, click the VNC icon in the top-right corner of the screen to
open VNC. Then click the status menu and select Licensing.
• Enter the email address and password you created in step one.
• When prompted, select “Direct and cloud connectivity.” Your Raspberry Pi is now
accessible online.
• Download the VNC Viewer application on the computer you want to control the
Raspberry Pi from, like the laptop or smartphone you’ll have when you travel.
Open the VNC Viewer application and enter the credentials you created in step one.
Your Raspberry Pi will pop up as an option automatically. Select it to open up the connection.
When prompted, enter your Raspberry Pi’s username and password (by default this is the
username “pi” and “toor” raspberry). Within a few second it’ll connect.
PG. 24
Sniffing VoIP calls using Raspberry pi Vighnesh Raje (@s3curityg33k)
You’re now able to log into your Raspberry Pi’s graphic desktop from anywhere as long as
your Raspberry Pi has internet access.
Tcpdump is a common packet analyser that runs under the command line. It allows the user to
display TCP/IP and other packets being transmitted or received over a network to which the
computer is attached. Distributed under the BSD license, tcpdump is free software. [13]
Now user needs to install Ettercap. We will be using Ettercap text only version for ARP
Spoofing.
Ettercap is a free and open source network security tool for man-in-the-middle attacks on
LAN. It can be used for computer network protocol analysis and security auditing. It runs on
various Unix-like operating systems including Linux, Mac OS X, BSD and Solaris, and on
Microsoft Windows. [14]
Next up, user needs to install python PyDrive library which will be useful for pushing files to
the google drive.
PG. 25
Sniffing VoIP calls using Raspberry pi Vighnesh Raje (@s3curityg33k)
We have setup a raspberry pi inside the same network of that of the two softphones. The
investigator connects to this raspberry pi using VNC Connect cloud service through a remote
location.
The first step is to find the IP address of softphone, for that the investigator needs to run a nmap
scan.
Once the IP address is known, the investigator needs to proceed by calling the custom python
script which we have named as “sip_exploitation.py”.
PG. 26
Sniffing VoIP calls using Raspberry pi Vighnesh Raje (@s3curityg33k)
Sip_exploitation.py will ask for victim IP address. Enter the softphone IP address found
through nmap scan.
The script will then try to perform an ARP spoof on the victim using Ettercap API.
Consecutively, the script will also try to capture UDP packets belonging to the victim. Once
the packet capture is completed the script will try to upload the pcap file on to google drive.
PG. 27
Sniffing VoIP calls using Raspberry pi Vighnesh Raje (@s3curityg33k)
A web browser will be prompted asking to choose an account to which the script would be
updated.
Note: Network congestion issues were seen when the script tried to upload the pcap on the
drive. To avoid this, it is advisable to force shut the thread performing ARP spoofing once the
packet capture is completed. For this press “Ctrl+C” on the terminal instance performing ARP
spoofing.
PG. 28
Sniffing VoIP calls using Raspberry pi Vighnesh Raje (@s3curityg33k)
After this, the packet capture file would be uploaded on the drive.
Now the investigator can try to listen to the VoIP conversation taken place between the two
softphone users on his remote system.
For this, the investigator first needs to download the packet capture file from the drive.
For viewing all VoIP packets, apply the following filter “sip || rtp”.
PG. 29
Sniffing VoIP calls using Raspberry pi Vighnesh Raje (@s3curityg33k)
Here, the investigator will be able to hear the conversation that took place between the two
suspects.
PG. 30
Sniffing VoIP calls using Raspberry pi Vighnesh Raje (@s3curityg33k)
7. Conclusion
Outcome of this project work will assist forensic investigators in covertly sniffing and
intercepting VoIP calls. This project will act as a basic guideline for the investigators and they
can take help of findings of this project to speed up their investigation.
PG. 31
Sniffing VoIP calls using Raspberry pi Vighnesh Raje (@s3curityg33k)
8. References
[1] Michael Dosch and Steve Church. "VoIP in the Broadcast Studio". Axia Audio. Archived
from the original on October 7, 2011. Retrieved June 21, 2011.
[2] https://indianexpress.com/article/cities/mumbai/criminals-making-voip-calls-cops-seek-
dot-help/
[3] Rakesh Arora. “Voice over IP: Protocols and Standards” dated November 23, 1999.
http://www.cis.ohio-state.edu/~jain/cis788-99/voip_protocols/index.html
[5] Santi Phithakkitnukoon, Enkh-Amgalan Baatarjav, Ram Dantu. “VoIP Security – Attacks
and Solutions” dated March 06, 2015. https://www.researchgate.net/publication/220449868
[6] Dharmin Suthar. “VoIP Penetration Testing and Forensics” dated April, 2018.
[7] Hardik Tandel, Dr. Parag Rughani. “Forensic Analysis of Asterisk-FreePBX based VoIP
Server” dated June, 2018. https://www.researchgate.net/publication/326046523
[8] Yusuf Turk, Onur Demir, Sezer G ̈oren. “Real Time Wireless Packet Monitoring with
Raspberry Pi Sniffer”. https://san.ee.ic.ac.uk/iscis2014/proceedings/27_turk.pdf
[9] https://www.asterisk.org/get-started
[10] https://www.softwareadvice.com/voip/zoiper-profile/
[11] https://www.raspberrypi.org/products/raspberry-pi-3-model-b/
[12] https://lifehacker.com/how-to-control-a-raspberry-pi-remotely-from-anywhere-in-
1792892937
[13] https://www.tcpdump.org/manpages/tcpdump.1.html
[14] https://en.wikipedia.org/wiki/Ettercap_(software)
[15] https://pythonhosted.org/PyDrive/
PG. 32