unit3
unit3
UNIT -3
Network sniffing
• Network sniffing is a type of attack where an attacker
captures the packets across a wire or across air
(wireless connection).
• The main goal is to capture unencrypted credentials
across the network.
• The common target protocols include FTP, HTTP,
and SMTP.
Types of Sniffing
• Sniffing can be primarily divided into two main categories:
• 1. Active sniffing
• 2. Passive sniffing
• root@root: cd/usr/local/share/nmap/scripts
• root@root:/usr/local/share/nmap/scripts# wget
• Usage Now that we have installed vulscan.nse script,
we will use the following command to run it:
• root@bt:~# driftnet –v
Sniffing Pictures with Drifnet
Urlsnarf and Webspy
• Urlsnarf and webspy is part of the dsniff
toolset; urlsnarf tells us about the URL that the
victim has visited,
• whereas the webspy tool will open up all the
web pages that the victim has visited in our
browser
Urlsnarf
Urlsnarf and Webspy
• root@bt:~# webspy –I eth0
192.168.75.142
• where eth0 is the interface and
192.168.75.142 is the IP address of the victim.
Urlsnarf and Webspy
ARP Poisoning with Ettercap
Ettercap
• Ettercap is said to be the Swiss army knife of
network-based attacks. With ettercap, you can
perform different types of ARP spoofing attacks.
• In addition, it has lots of interesting plug-ins you can
use.
• It is recommended to use ettercap over arpspoof and
other tools in the dsniff toolset because it has more
features and you can do pretty much any task with
ettercap, to accomplish which you will need multiple
tools in dsniff
• ARP Poisoning with Ettercap Let’s start by
performing an ARP poisoning attack with Ettercap.
Just follow these steps:
• Step 1—Launch ettercap by executing the following
command:
• root@bt:#ettercap –G
• Step 2—Next, click on the “Sniff” button at the top
and then “Unsniffed bridging” and finally select your
appropriate interface
• Step 3—Next, click on “Host List” at the top and
click on “Scan for host.” It will scan the whole
network for all live hosts.
• Step 4—Once the scan is complete, from the
hosts menu, click on “Hosts List.” It will
display all the hosts that it has found within
your network.
• Step 5—Next, we need to choose our targets. In this
case, I would like to perform sniffing between my
victim host running Windows XP machine on
192.168.75.142 and our default gateway
192.168.75.2.
• We will add 192.168.75.142 to target 1 and add
192.168.75.2 to target 2.
• Step 6—Next click on the “MITM” tab at the top and
click on “ARP Poisoning” and then click “Ok” to
launch the attack
• Step 7—now ,we are capturing all the traffic going to
and from the default gateway and the victim.
• Step 8—Finally click on “Start sniffing,” and it will
start sniffing the traffic.
• We can check if ARP cache has been successfully
poisoned by using the “chk _ poison” plug-in from
Ettercap.
ARP Poisoning with Cain and Abel
• Entire process of ARP poisoning a network with Cain
and Abel can be divided the process into five steps:
• Step 1—Download “Cain and Abel” from the
following link, install it, and launch it.
http://oxid.it/cain.html
• Step 2—Turn on the sniffer by clicking on the green
button at the top just above the decoder tab.
• Next, scan for the MAC addresses by clicking on the
plus sign (+) at the top.
• This will bring us all the hosts inside our subnet.
Alternatively, you can also define your own range and set your targets
• Step 3—Once you have scanned all the MAC
addresses and IP addresses, it’s time to perform an
ARP spoofing attack.
• To do that, click on the “APR” tab at the bottom and
then click on the white area in the top frame.
• This will turn the “+” sign into blue color
• Step 4—Next click on the “+” sign; lists of hosts will
appear. Select the hosts that you want to intercept the
traffic between.
• In my case, at the left side would be my default
gateway and on the right would be my victim hosts.
• Step 5—Click “Ok” and then finally click on the
yellow button just under the file menu.
• And it will begin poisoning the routes in a short span
of time and you will start to see traffic being captured
by Cain and Abel.
Sniffing with Wireshark
• Wireshark is an extensive tool. We will use
Wireshark to capture plain text passwords sent
across the wire. :
• Step 1—Launch Wireshark by executing
“Wireshark” command from the terminal. Once
launched, click on the “Capture” button at the top
and click on the “Analyze” button.
• Step 2—Next, select the interface you would like
to sniff on and click “Start”; in my case, it is eth0
Step 3—Wireshark will start capturing all the packets going across the
network. On the victim’s machine afer that log into a website that supports
http authentication and will stop the capture on my attacker machine once I
have logged in.
Step 4—Since we have so many packets, we need to ask Wireshark to
filter out only HTTP POST requests. So, inside of the filter tab, we will
type “http.request.method==POST.”
The first request you see is a “POST” request performed to the
destination 75.98.17.25 from our victim, which has a source IP
192.168.75.142
Step 5—Next, we will right-click on the packet and click on “Follow tcp
stream,” which will show us the original post request generated from the
victim’s browser. The output would look something like the following
As you can see, the POST request contains the username “admin” and the
password “pass.” There are many different types of filters in Wireshark used
to filter out different types of traffic.
Urlsnarf and Webspy
• Urlsnarf and webspy is part of the dsniff toolset;
urlsnarf tells us about the URL that the victim has
visited, whereas the webspy tool will open up all the
web pages that the victim has visited in our browser
• An example of attacker running urlsnarf to sniff the
URLs that victim has visited.
• The websnarf works the same way; however, we need
to specify additional arguments.
• Here is how the command would look like:
root@bt:~# webspy –i eth0 192.168.75.142
• where eth0 is the interface and 192.168.75.142 is the
IP address of the victim
• As urlsnarf keeps track of the URL’s visited by
the victim, as soon as the victims connects to a
new url using his browser or browser would
automatically connect to it too, we would
know what pages the victim is curently on
Using ARP Spoof to Perform MITM
Attack
• Before we perform a man in the middle attack, we
need to enable IP forwarding so that the traffic
could be forwarded to the destination.
• In order to enable it, we will use the following
• command: echo 1 >/proc/sys/net/ipv4/ip_forward
• We can confirm that port forwarding is enabled
by using the cat command to display the contents
of the ip _ forward file. “1” means that IP
forwarding is enabled; “0” means it’s disabled.
Now that we have enabled IP forwarding, we need to gather the following
information to perform an man in the middle attack:
1. Attacker’s IP
2. 2. Victim’s IP
3. 3. Default gateway