Docsity

Sniffer Buster-Computer Sciences Applications-Project Report, Study Guides, Projects, Research of Applications of Computer Sciences

Toggle sidebar
bg1
Table of Contents
Table of Contents ---------------------------------------------------------------------------------- i
List of Tables --------------------------------------------------------------------------------------- ii
List of Figures ------------------------------------------------------------------------------------ iii
Abstract --------------------------------------------------------------------------------------------- iv
Project Time Line --------------------------------------------------------------------------------- v
1. Sniffing in shared Networks ------------------------------------------------------------ 1
1.1 Types of Network Interface Card (NIC) Filters ------------------------------------- 3
1.1.1 Unicast ------------------------------------------------------------------------------- 3
1.1.2 Multicast ----------------------------------------------------------------------------- 4
1.1.3 All multicast ------------------------------------------------------------------------- 4
1.1.4 Broadcast ---------------------------------------------------------------------------- 4
1.2 Promiscuous mode of Sniffing --------------------------------------------------------- 5
1.3 IP based Sniffing ------------------------------------------------------------------------- 5
1.4 MAC based Sniffing --------------------------------------------------------------------- 6
2. Sniffing in Switched networks --------------------------------------------------------- 7
2.1 ARP Cache poisoning MAN in the Middle ------------------------------------------ 7
2.2 MAC Flooding--------------------------------------------------------------------------- 12
2.3 MAC Duplicating / Port Stealing ----------------------------------------------------- 14
References ----------------------------------------------------------------------------------------- 17
docsity.com
pf3
pf4
pf5
pf8
pf9
pfa
pfd
pfe
pff
pf12
pf13
pf14
pf15
pf16

Partial preview of the text

Download Sniffer Buster-Computer Sciences Applications-Project Report and more Study Guides, Projects, Research Applications of Computer Sciences in PDF only on Docsity!

Table of Contents

Table of Contents ---------------------------------------------------------------------------------- i List of Tables --------------------------------------------------------------------------------------- ii List of Figures ------------------------------------------------------------------------------------ iii Abstract --------------------------------------------------------------------------------------------- iv Project Time Line --------------------------------------------------------------------------------- v

  1. Sniffing in shared Networks ------------------------------------------------------------ 1 1.1 Types of Network Interface Card (NIC) Filters ------------------------------------- 3 1.1.1 Unicast ------------------------------------------------------------------------------- 3 1.1.2 Multicast ----------------------------------------------------------------------------- 4 1.1.3 All multicast ------------------------------------------------------------------------- 4 1.1.4 Broadcast ---------------------------------------------------------------------------- 4 1.2 Promiscuous mode of Sniffing --------------------------------------------------------- 5 1.3 IP based Sniffing ------------------------------------------------------------------------- 5 1.4 MAC based Sniffing --------------------------------------------------------------------- 6
  2. Sniffing in Switched networks --------------------------------------------------------- 7 2.1 ARP Cache poisoning MAN in the Middle ------------------------------------------ 7 2.2 MAC Flooding--------------------------------------------------------------------------- 12 2.3 MAC Duplicating / Port Stealing ----------------------------------------------------- 14 References ----------------------------------------------------------------------------------------- 17

ii

List of Tables

Table 1-1 Packet processing difference for IP --------------------------------------------------- 6 Table 1-2 Packet Processing Difference for MAC ---------------------------------------------- 6

iv

Abstract

This document contains information of progress report of the project named “Sniffer Buster”. The main objective of the project is to develop an anti sniffer that will be able to detect different kind of sniffers and try to block them operating in an Ethernet environment. The task of development will be done after a comprehensive study. As a first part of study this midterm report of 7th^ semester contains material about different sniffing techniques, what are they? Their theory and how they work?

v

Project Time Line

The project time line is shown in the table below.

Every time a new machine/host present in Ethernet communicate with any other host its MAC and IP addresses are added into the cache of NIC card.

In Ethernet ARP (Address Resolution Protocol) plays an important role in communication and data transfers between the machines. RFC 286 defines ARP mainly. ARP is used to map MAC addresses with the IP addresses.

More about ARP is described in the later part of this report here an example is given how IP and MAC address are resolved using ARP. For this purpose let there is a host A with IP address as 172.30.10.5 and MAC address ab:cd:ef:gh:ij:kl and wants to communicate with another host in the network that have an IP address 172.30.10.7 and unknown MAC address. A setup is shown in the figure 1-2 below.

Figure 1-2 Setup before communication starts

Now host A constructs an ARP request packet that have A’s IP and MAC address and B’s IP address but MAC address FF:FF:FF:FF:FF:FF that is broad cast address so that every one in the Ethernet can get the packet.

The packet will be available at all ports but only that host which is in this case host B will receive the packet as it contains the IP address of B. All other hosts will ignore the message because of difference in IP addresses. When the host B receives the message it

IPs MACs 172.30.10.7 aa:00:01:00:00:

IPs MACs 172.30.10.5 ab:cd:ef:gh:ij:kl

constructs an ARP reply packet that contains the destination IP and MAC addresses as of A and own IP and MAC addresses. Host A receives the packet and an entry will be made in its NIC’s cache then the communication will be started as A have IP and MAC address of B and vice versa as shown in figure 1-3 below.

Figure 1-3 Status after starting communication

IPs MACs 17 2.30.10.5 ab:cd:ef:gh:ij:kl 172.30.10.7 aa:00:01:00:00:

NIC have two main modes of operation one is Normal mode and the other one is Promiscuous mode. In Normal mode of operation when a packet arrives at a port the MAC addresses of the NIC (Network Interface Card) is matched with the destination MAC field of the packet, by MAC address filter, that is present at the port if it is matched then the packet is received by the Network Interface Card and passed on to the IP filter then sent to operating system’s kernel for further processing. In Normal mode of operation hardware filter filters four types of packets.

1.1 Types of Network Interface Card (NIC) Filters

1.1.1 Unicast

Accept the packets that contain the MAC address as of the machine’s MAC address. See figure 1-4.

IPs MACs 17 2.30.10.7 aa:00:01:00:00: 172.30.10.5 ab:cd:ef:gh:ij:kl

1.2 Promiscuous mode of Sniffing

The purpose of sniffing is only achieved by putting the network card into promiscuous mode of operation in both Ethernet environments Shared and Switched. In shared Ethernet one way of sniffing is putting the network card into promiscuous mode and sniffing all the traffic present in the network.

In promiscuous mode of operation Network interface card doesn’t use the MAC and IP filters for the identifications of the packets instead of that all the data packets are passed onto the operating systems kernel where further processing is done. The following figure 1-5 shows the promiscuous mode of sniffing. H1 (host 1), H2 (host 2), H3 (host 3) are in normal mode but h4 (host 4) is in promiscuous mode and gets all the packets.

Figure 1-5 Noarmal vs Promiscuous mode

Now considering the figure H1, H2, H3 will get the traffic that is only destined for them but H4 will get all the traffic that is sent by any other host either H1 sent to H2 or H sends to H3 or H1 sends to H3 or vice versa.

1.3 IP based Sniffing

This is meant as the original type of sniffing. In IP based sniffing first network card is put into promiscuous mode then the packets are captured by comparing source IP addresses of the packets using IP filter. IP filter can filter the data for one or more than one IP addresses at the same time that is how we can sniff/capture the data coming from one or more machines/hosts. This technique is used for sniffing one or more specific host’s data that are targeted by the user. See table 1-1 to know the difference of packet processing.

Table 1-1 Packet processing difference for IP

1.4 MAC based Sniffing

MAC based sniffing is another type of sniffing that is done by putting the network card into promiscuous mode of operation and using a MAC address filter that will filter the traffic based on MAC addresses given to the filter. In this way we also can sniff/capture data coming from one or more hosts. In this way all the data is not captured only the data that is to be needed is captured that is coming from the target host at that time. Table 1- shows packet processing.

Table 1-2 Packet Processing Difference for MAC

IP based filtering Normal mode Promiscuous mode Others… Others… Others… NO IP matching/checks IP matching/checks NO IP matching/checks MAC matching/checks MAC matching/checks

NO MAC

matching/checks

IP based filtering Normal mode Promiscuous mode Others… Others… Others… IP filter IP matching/checks NO IP matching/checks MAC matching/checks

MAC

matching/checks

NO MAC matching/checks

Packet processing

Packet processing

RARP request: a reverse ARP packet that is used to find the IP address of some host using its MAC address.  RARP reply : reverse ARP reply packet is sent as a response to the request contains IP address of the destination host.

Since ARP is a stateless protocol and is unable to keep track of its packets it means that manually made ARP packets can be sent over the Ethernet and manipulations can be made in caches of switches. Basically, an ARP message on an Ethernet/IP network has 8 important parameters, the fields are:  Ethernet header:

  • Source MAC address
  • Destination MAC address
  • Ethernet Type (=0x0806 for ARP message)  ARP message header:
  • Source IP address
  • Source MAC address
  • Destination IP address
  • Destination MAC address
  • Operation code: 1 : for ARP request 2: for ARP reply

Figure 2-1 shows the frame structure of an ARP packet with bits allocation.

Figure 2-1 ARP Packet Foarmat

For ARP cache poisoning man in the middle attack first step is to manipulate the ARP caches of the other hosts. For understanding of ARP cache poisoning first we have to get the IP address and MAC address of the host this can be done in windows command prompt using the command arp – a this command will list all the IP and MAC addresses present in the cache of host as shown in a figure 2-2 below.

Figure 2-2 Screenshot of a computer's ARP cache

In UNIX and Linux ifconfig command can be used to get the MAC address of Host. IP and MAC addresses also can be find by other methods like ARP request and reply packets. ARP request and reply packet are gladly received by the hosts present in the network. Now for example we consider three devices/hosts with addresses listed below; Attacker: IP address: 192.30.10. MAC address: aa:ss:dd:ff:gg:h First victim: IP address: 192.30.10. MAC address: aa:ss:dd:ff:gg:h Second victim: IP address: 192.30.10. MAC address: aa:ss:dd:ff:gg:h

Figure 2-4 Status after poisoning victim1's cache Half part is done now to hide the attacker that victim2 not find that data is not approaching its destination the packet will be forward to the victim2. This can be done easily by enabling IP forwarding functionality available in operating systems.

In this way only one way traffic can be captured by the attacker to capture the full session same method will be used to poison the ARP cache of the victim2 so that the data will be pass through attacker. After poisoning victim2’s cache will also contains the IP address of victim1 but MAC address of attacker as shown in figure 2-5 and send data to attacker and the attacker then forwards the traffic to victim1.

Figure 2-5 Status after poisoning cache of victim1 and victim

This is how man in the middle attack completes. In this part attacker is playing the role of man in the middle.

2.2 MAC Flooding

Every Switch in an Ethernet contains a table that contains the MAC addresses entries that they use to map against the physical ports. By mapping MAC addresses to Physical ports they send packets only to the destined host and not any other. This is how the packets are routed intelligently by the switches as shown in the figure 2-6 below.

Figure 2-7 Routing of packets after MAC Flooding attack

2.3 MAC Duplicating / Port Stealing

This technique uses the MAC Flooding also to sniff the traffic between two hosts and work by stealing the port of the target host so that the traffic coming to that port is first sent to the attacker. As switches binds the MAC addresses to its different ports and one port is allotted to one MAC address.

To steal the port of the target system ARP reply packets are used that contains sender address as the address of the target and receivers MAC address as of the attacker. For example if we have; Attacker: MAC address: aa:00:00:00:00:

Target: MAC address: tt:00:00:00:00: Then the packet will contains; Sender’s MAC address: tt:00:00:00:00: Receiver’s MAC address: a a:00:00:00:00:

In other words the attacker that is actually sending the packet, according to the destination address mentioned in receiver’s field, is the receiver of the packet and is sending the packets for itself. But it is just to fool the switch. The attacker flood the switch with the packets as mentioned earlier but this process of flooding is different from that of used in previous MAC Flooding used in previous section. As the destination of the packet is the attacker itself the packets are sent back to the attacker and no other host will be able to notice the presence of such kind of packets as shown in figure 2-8. In the figure Host3 is doing the flooding.

Figure 2-8 MAC flooding for Port Stealing attack

Now when data packets that are destined for the target host comes to the switch a race condition will be started as the target host will send packets too. The switch will notice that same MAC address is available at two of its ports then it constantly changes the binding of MAC addresses to the port. But the binds one port with one MAC address at a time. Now if the attacker is fast than the target then it wins and gets the packets intended