Modulehyfxgjjjcc
Modulehyfxgjjjcc
Sniffing and
Spoofing
Ansh Bhawnani
Sniffing Concepts
Module 10
1. Introduction
Module 10
Sniffing Concepts
4
Sniffing Concepts
5
Sniffing Concepts
6
2. Types of Sniffing
Module 10
Sniffing Concepts
▰ Passive Sniffing
▻ Passive sniffing means sniffing through a hub, on a hub the traffic
is sent to all ports.
▻ It involves only monitoring of the packets sent by others without
sending any additional data packets in the network traffic.
▻ In a network that use hubs to connect systems, all hosts on the
network can see all traffic therefore attacker can easily capture
traffic going through the hub.
▻ Hub usage is out-dated today. Most modern networks use
switches. 8
Sniffing Concepts
9
Sniffing Concepts
▰ Active Sniffing
▻ Active sniffing is used to sniff a switch-based network.
▻ The attacker forces a switch to act like a hub.
▻ Active sniffing involves injecting address resolution packets (ARP)
into the network to flood the switch's Content Addressable
Memory (CAM) table, CAM keeps track of which host is connected
to which port.
10
Sniffing Concepts
11
Sniffing Concepts
12
Sniffing Concepts
15
3. Hardware Protocol
Analyzer
Module 10
Sniffing Concepts
18
4. Wiretapping
Module 10
Sniffing Concepts
21
Sniffing Concepts
▰ Lawful Interception
▻ Lawful interception refers to legally intercepting data communication between
two end points for surveillance on the traditional telecommunications, VoIP,
data, and multiservice networks.
▰ Wiretapping Case Study: PRISM
▻ PRISM stands for "Planning Tool for Resource Integration, Synchronization,
and Management," and is a "data tool" designed to collect and process
"foreign intelligence" that passes through American servers.
▻ NSA wiretaps a huge amount of foreign internet traffic that is routed through
or saved on U.S. servers.
22
MAC Attacks
Module 10
1. MAC Flooding
Module 10
MAC Attacks
25
MAC Attacks
26
MAC Attacks
27
MAC Attacks
28
MAC Attacks
29
MAC Attacks
▰ MAC Flooding
▻ MAC flooding involves flooding of CAM table with fake MAC address
and IP pairs until it is full.
▻ Switch then acts as a hub by broadcasting packets to all machines on
the network and attackers can sniff the traffic easily.
30
2. Switch Port
Stealing
Module 10
MAC Attacks
▰ Switch Port Stealing sniffing technique uses MAC flooding to sniff the
packets.
▰ Attacker floods the switch with forged gratuitous ARP packets with target
MAC address as source and his own MAC address as destination.
▰ A race condition of attacker's flooded packets and target host packets will
occur and thus switch has to change his MAC address binding constantly
between two different ports.
32
MAC Attacks
▰ In such case if attacker is fast enough, he will able to direct the packets
intended for the target host toward his switch port.
▰ Attacker now manages to steal the target host switch port and sends ARP
request to stolen switch port to discover target hosts' IP address.
▰ When attacker gets ARP reply, this indicates that target host's switch port
binding has been restored and attacker can now able to sniff the packets
sent toward targeted host.
33
3. Defend against
MAC attacks
Module 10
MAC Attacks
35
DHCP Attacks
Module 10
1. How DHCP works
Module 10
DHCP Attacks
39
DHCP Attacks
40
2. DHCP Starvation
attack
Module 10
DHCP Attacks
42
DHCP Attacks
43
DHCP Attacks
44
3. Rogue DHCP
server attack
Module 10
DHCP Attacks
▰ Attacker sets rogue DHCP server in the network and responds to DHCP
requests with bogus IP addresses; this results in compromised network
access.
▰ This attack works in conjunction with the DHCP Starvation attack; attacker
sends TCP/IP setting to the user after knocking him/her out from the
genuine DHCP server.
46
DHCP Attacks
47
4. Defend Against
DHCP Starvation and
Rogue Server Attack
Module 10
DHCP Attacks
49
ARP Attacks
Module 10
1. ARP Introduction
Module 10
ARP Attacks
▰ If one of the machine in the network identifies with this address, it will
respond to ARP_REQUEST with its IP and MAC address. The requesting
machine will store the address pair in the ARP table and communication will
take place.
53
2. ARP Spoofing
Attack
Module 10
ARP Attacks
55
3. How ARP
Spoofing works
Module 10
ARP Attacks
57
ARP Attacks
58
ARP Attacks
60
4. Defend against
ARP Poisoning
Module 10
ARP Attacks
63
ARP Attacks
64
ARP Attacks
65
Spoofing Attacks
Module 10
1. MAC Spoofing
Module 10
Spoofing Attacks
▰ MAC Spoofing/Duplicating
▻ MAC duplicating attack is launched by sniffing a network for
MAC addresses of clients who are actively associated with a
switch port and re-using one of those addresses.
▻ By listening to the traffic on the network, a malicious user can
intercept and use a legitimate user's MAC address to receive
all the traffic destined for the user.
▻ This attack allows an attacker to gain access to the network
and take over someone's identity already on the network.
▻ Defense: Use DHCP Snooping Binding Table, Dynamic ARP
68
Inspection, and IP Source Guard.
Spoofing Attacks
69
2. IRDP Spoofing
Module 10
Spoofing Attacks
▰ ICMP Router Discovery Protocol (IRDP) is a routing protocol that allows host
to discover the IP addresses of active routers on their subnet by listening to
router advertisement and solicitation messages on their network.
▰ Attacker sends spoofed IRDP router advertisement message to the host on
the subnet, causing it to change its default router to whatever the attacker
chooses.
▰ This attack allows attacker to sniff the traffic and collect the valuable
information from the packets.
▰ Attackers can use IRDP spoofing to launch man-in-the-middle, denial-of-
service, and passive sniffing attacks.
71
Spoofing Attacks
72
DNS Spoofing/
DNS Poisoning
Module 10
1. Introduction
Module 10
DNS Spoofing
▰ DNS poisoning is a technique that tricks a DNS server into believing that it
has received authentic information when, in reality, it has not.
▰ It results in substitution of a false IP address at the DNS level where web
addresses are converted into numeric IP addresses.
▰ It allows attacker to replace IP address entries for a target site on a given
DNS server with IP address of the server he/she controls.
▰ Attacker can create fake DNS entries for the server (containing malicious
content) with same names as that of the target server.
75
2. Intranet DNS
Spoofing
Module 10
DNS Spoofing
▰ For this technique, you must be connected to the local area network (LAN)
and be able to sniff packets.
▰ It works well against switches with ARP poisoning the router.
77
3. Internet DNS
Spoofing
Module 10
DNS Spoofing
79
4. Proxy Server DNS
Poisoning
Module 10
DNS Spoofing
81
5. DNS Cache
Poisoning
Module 10
DNS Spoofing
▰ DNS cache poisoning refers to altering or adding forged DNS records into the DNS resolver cache so
that a DNS query is redirected to a malicious site.
▰ If the DNS resolver cannot validate that the DNS responses have come from an authoritative source,
it will cache the incorrect entries locally and serve them to users who make the same request.
83
DNS Spoofing
84
6. How to Defend
Against DNS
Spoofing
Module 10
DNS Spoofing
Module 10
Sniffing Detection
▰ Promiscuous Mode:
▻ You will need to check which machines are running in the promiscuous
mode.
▻ Promiscuous mode allows a network device to intercept and read each
network packet that arrives in its entirety.
▰ IDS:
▻ Run IDS and notice if the MAC address of certain machines has
changed (Example: router's MAC address)
▻ IDS can alert the administrator about suspicious activities.
88
Sniffing Detection
▰ Network Tools:
▻ Run network tools such as Capsa Network Analyzer to monitor the
network for strange packets.
▻ It enables you to collect, consolidate, centralize and analyze traffic
data across different network resources and technologies.
89
1. Ping method
Module 10
Sniffing Detection
▰ Send a ping request to the suspect machine with its IP address and incorrect MAC address. The
Ethernet adapter reject it, as the MAC address does not match, whereas the suspect machine
running the sniffer responds to it as it does not reject packets with a different MAC address.
91
2. ARP method
Module 10
Sniffing Detection
93
Sniffing Detection
94
3. DNS method
Module 10
Sniffing Detection
▰ Most of the sniffers perform reverse DNS lookup to identify the machine
from the IP address.
▰ A machine generating reverse DNS lookup traffic will be most likely running
a sniffer.
96
4. Nmap method
Module 10
Sniffing Detection
▰ Nmap's NSE script allows you to check if a target on a local Ethernet has its network
card in promiscuous mode.
▰ Command to detect NIC in promiscuous mode:
▻ nmap --script=sniffer-detect [Target IP Address/Range of IP addresses]
98
Countermeasures
Module 10
Countermeasures
▰ Restrict the physical access to the network media to ensure that a packet
sniffer cannot be installed.
▰ Use encryption to protect confidential information.
▰ Permanently add the MAC address of the gateway to the ARP cache.
▰ Use static IP addresses and static ARP tables to prevent attackers from
adding the spoofed ARP entries for machines in the network.
▰ Turn off network identification broadcasts and if possible restrict the
network to authorized users in order to protect network from being
discovered with sniffing tools.
100
Countermeasures
▰ Use tools to determine if any NICs are running in the promiscuous mode.
▰ Use IPv6 instead of IPv4 protocol.
▰ Use encrypted sessions such as SSH instead of Telnet, Secure Copy (SCP)
instead of FTP, SSL for email connection, etc. to protect wireless network
users against sniffing attacks.
▰ Use HTTPS instead of HTTP to protect user names and passwords.
▰ Use switch instead of hub as switch delivers data only to the intended
recipient.
101
Countermeasures
102
HACKING
Is an art, practised through a creative mind.
103