Showing posts with label Switches. Show all posts
Showing posts with label Switches. Show all posts

Bypassing the Limitations of Switches



Because of the way Ethernet switches operate, it is more difficult to gather useful information when sniffing on a switched network. Since most modern networks have been upgraded from hub to switches, it takes a little more effort to sniff on a switched network. One of the ways to do that is to trick the switch into sending the data to the hackers' computer using ARP poisoning.

How ARP Works

ARP allows the network to translate IP addresses into MAC addresses. When one host using TCP/IP on a LAN tries to contact another, it needs the MAC address or hardware address of the host it's trying to reach. It first looks in its ARP cache to see if it already has the MAC address; if it doesn't, it broadcasts an ARP request asking, "Who has the IP address I'm looking for?" If the host that has that IP address hears the ARP query, it responds with its own MAC address, and a conversation can begin using TCP/IP.
ARP poisoning is a technique that's used to attack an Ethernet network and that may let an attacker sniff data frames on a switched LAN or stop the traffic altogether. ARP poisoning utilizes ARP spoofing, where the purpose is to send fake, or spoofed, ARP messages to an Ethernet LAN. These frames contain false MAC addresses that confuse network devices such as network switches. As a result, frames intended for one machine can be mistakenly sent to another (allowing the packets to be sniffed) or to an unreachable host (a denial-of-service, or DoS, attack). ARP spoofing can also be used in a man-in-the-middle attack, in which all traffic is forwarded through a host by means of ARP spoofing and analyzed for passwords and other information.

ARP Spoofing and Poisoning Countermeasures

To prevent ARP spoofing, permanently add the MAC address of the gateway to the ARP cache on a system. You can do this on a Windows system by using the ARP -scommand at the command line and appending the gateway's IP and MAC addresses. Doing so prevents a hacker from overwriting the ARP cache to perform ARP spoofing on the system but can be difficult to manage in a large environment because of the number of systems. In an enterprise environment, port-based security can be enabled on a switch to allow only one MAC address per switch port.
In Exercise 1 you will use Wireshark to sniff traffic.
Exercise 1: Use Wireshark to Sniff Traffic

  1. Download and install the latest stable version of Wireshark from www.wireshark.org.
  2. Click on the Capture menu and then select interfaces.

  3. Click the Start button next to the interface that shows packets being sent and received. If you have multiple interfaces with packet activity, choose one of them—preferably the interface with the most activity.
  4. Click on a packet to analyze that single packet. The detailed headers will be displayed beneath the packet capture screen.
  5. Expand each header (IP, TCP) of a packet and identify the address information.
This exercise will provide much more network traffic if performed on a hub rather than a switch. A wireless network can be used, as a wireless LAN is a shared network segment similar to how a hub operates.

nmap Command Switches



Nmap is a free, open source tool that quickly and efficiently performs ping sweeps, port scanning, service identification, IP address detection, and operating system detection. Nmap has the benefit of scanning a large number of machines in a single session. It's supported by many operating systems, including Unix, Windows, and Linux.
The state of the port as determined by an nmap scan can be open, filtered, or unfiltered. Open means that the target machine accepts incoming request on that port. Filteredmeans a firewall or network filter is screening the port and preventing nmap from discovering whether it's open. Unfiltered mean the port is determined to be closed, and no firewall or filter is interfering with the nmap requests.
Nmap supports several types of scans. Table 1 details some of the common scan methods.
Table 1: Nmap scan types 
Nmap scan type
Description
TCP connect
The attacker makes a full TCP connection to the target system. The most reliable scan type but also the most detectable. Open ports reply with a SYN/ACK while closed ports reply with a RST/ACK.
XMAS tree scan
The attacker checks for TCP services by sending XMAS-tree packets, which are named as such because all the "lights" are on, meaning the FINURG, and PSHflags are set (the meaning of the flags will be discussed later in this chapter). Closed ports reply with a RST flag.
SYN stealth scan
This is also known as half-open scanning. The hacker sends a SYN packet and receives a SYN-ACK back from the server. It's stealthy because a full TCP connection isn't opened. Open ports reply with a SYN/ACK while closed ports reply with a RST/ACK.
Null scan
This is an advanced scan that may be able to pass through firewalls undetected or modified. Null scan has all flags off or not set. It only works on Unix systems. Closed ports will return a RST flag.
Windows scan
This type of scan is similar to the ACK scan and can also detect open ports.
ACK scan
This type of scan is used to map out firewall rules. ACK scan only works on Unix. The port is considered filtered by firewall rules if an ICMP destination unreachable message is received as a result of the ACK scan.
The nmap command has numerous switches to perform different types of scans. The common command switches are listed in Table 2.
Table 2: Common nmap command switches 
nmap command switch
Scan performed
-sT
TCP connect scan
-sS
SYN scan
-sF
FIN scan
-sX
XMAS tree scan
-sN
Null scan
-sP
Ping scan
-sU
UDP scan
-sO
Protocol scan
-sA
ACK scan
-sW
Windows scan
-sR
RPC scan
-sL
List/DNS scan
-sI
Idle scan
-Po
Don't ping
-PT
TCP ping
-PS
SYN ping
-PI
ICMP ping
-PB
TCP and ICMP ping
-PB
ICMP timestamp
-PM
ICMP netmask
-oN
Normal output
-oX
XML output
-oG
Greppable output
-oA
All output
-T Paranoid
Serial scan; 300 sec between scans
-T Sneaky
Serial scan; 15 sec between scans
-T Polite
Serial scan; .4 sec between scans
-T Normal
Parallel scan
-T Aggressive
Parallel scan, 300 sec timeout, and 1.25 sec/probe
-T Insane
Parallel scan, 75 sec timeout, and .3 sec/probe
To perform an nmap scan, at the Windows command prompt type Nmap IPaddress followed by any command switches used to perform specific type of scans. For example, to scan the host with the IP address 192.168.0.1 using a TCP connect scan type, enter this command:
Nmap 192.168.0.1 -sT
Make sure you're familiar with the different types of nmap scans, the syntax to run nmap, and how to analyze nmap results. The syntax and switches used by the nmap command will be tested on the CEH exam.

Popular Posts