Week 12
Week 12
Topic
Lecture 56: The NMAP Tool: A Relook (Part I)
q Introduc/on to NMAP
1
04/10/19
• NMAP is a free, open-source tool for vulnerability scanning and network discovery.
• Network administrators use NMAP for a variety of reasons:
• Essen/ally a port scanning tool.
• The packets that are sent out return with IP addresses and a wealth of other data.
• Can be used to:
• Discover hosts that are available on a network, and services that they offer.
• Find open ports and detect security risks.
• Determine OS versions.
• Variety of other things …
The History
2
04/10/19
A. Host Discovery
• Which hosts are alive? --- Various approaches are available
B. Port Scanning
• What services are available? --- By enumera/ng the open ports
C. Service and Version DetecJon
• Which version is running? --- Iden/fy applica/on name and version number
D. OS DetecJon
• Which OS version is running? --- Also iden/fy some hardware characteris/cs
3
04/10/19
No response
Scanner TARGET is down/filtered Target
4
04/10/19
Scanner
10
5
04/10/19
• How it works?
• Instead of ICMP ECHO request, the scanner sends out other types of ICMP messages.
• The target will respond to such messages.
• Approach 1: Send ICMP type 13 messages (TIMESTAMP)
• The scanner queries current /me to the target.
• Approach 2: Send ICMP type 17 messages (ADDRESS MASK REQUEST)
• The scanner queries subnet mask to the target (this feature is used by diskless worksta/ons
during boo/ng)
11
• To perform ICMP non echo sweep -PP and -PM op/on are used.
• -PP is used for ICMP /mestamp request (type 13)
• -PM is used for address mask request (type 17)
12
6
04/10/19
13
• How it works?
• The scanner sends out TCP SYN or TCP ACK packet to the target.
• The port number can be suitably selected to prevent blocking by firewall.
• Typical port numbers used: 21, 22, 23, 25, 80
• A drawback:
• Firewalls can spoof a RESET packet for an IP address, so TCP Sweep may not be reliable.
14
7
04/10/19
15
16
8
04/10/19
17
18
9
04/10/19
• How it works?
• The scanner sends a UDP datagram to the target.
• If no ICMP PORT UNREACHABLE message is received à TARGET IS ALIVE
• If an ICMP PORT UNREACHABLE message is received à TARGET IS DOWN
19
20
10
04/10/19
21
22
11
04/10/19
23
24
12
04/10/19
25
26
13
04/10/19
27
28
14
04/10/19
Topic
Lecture 57: The NMAP Tool: A Relook (Part II)
1
04/10/19
IntroducJon
2
04/10/19
Client Server
Client Server
• How it works?
SYN/ACK
• Do not establish complete connecJon (half-open scanning).
• SYN/ACK is received à The port is LISTENING
ACK
• Immediately terminate connecJon by sending RST.
• RST/ACK is received à The port is NON-LISTENING ConnecJon
SYN
Established
SYN/ACK
RST
Scanner Target
The port is OPEN
SYN
RST/ACK
3
04/10/19
4
04/10/19
• Basic idea:
• Carry out port scanning while avoiding detecJon.
• Try to hide themselves among normal network traffic.
• Not to be logged (stealth).
• How it works?
• Flag probe packets (also known as Inverse Mapping)
• Response is sent back only by closed port.
• Intruder determines what services do not exist, and can infer the ones that exist.
• Slow scan rate
• Difficult to detect, and needs long history log.
10
5
04/10/19
11
PORT 10.0.0.5,0,22
Scanner FTP Server Target
(10.0.0.4) (10.0.0.5)
TCP SYN
RST
425 Cannot build data connecJon
12
6
04/10/19
13
14
7
04/10/19
15
16
8
04/10/19
17
18
9
04/10/19
Topic
Lecture 58: The NMAP Tool: A Relook (Part III)
1
04/10/19
IntroducNon
2
04/10/19
3
04/10/19
4
04/10/19
• There are 1000s of scripts available with NMAP to perform various opera5on.
• The scripts can have there own specific requirements, like some services running,
port requirements, etc.
• We have already seen an example earlier:
--script vuln to check vulnerability in a system.
• Any script can be run using the command:
--script <script name> <port # if required> <target>
10
5
04/10/19
11
12
6
04/10/19
13
14
7
04/10/19
Some Issues
15
16
8
04/10/19
17
18
9
04/10/19
Topic
Lecture 59: Network Analysis using Wireshark
q About Wireshark
1
04/10/19
IntroducHon
What is Wireshark?
• It is an open source tool for profiling network traffic and analyzing packets.
• OTen referred to as a network analyzer, network protocol analyzer or sniffer.
• hJp://www.wireshark.org
2
04/10/19
Wireshark
• Can be downloaded from: hJp://www.wireshark.org
3
04/10/19
4
04/10/19
Applying Filter
• To filter packets put filter name in filter bar and press <enter> or the arrow.
• Restrict the packets that are displayed in summary window.
• For correct filter, bar will convert from white to green and for wrong filter it will be shown as
red.
10
5
04/10/19
11
12
6
04/10/19
13
14
7
04/10/19
15
File Menu
• We can divide File Menu into 3 major sec8ons as per their
func8onality.
• Import :
• Open: open captured file.
• Open recent: open recently captured file.
• Merge: merge current capture with other captured file.
• Import from hex dump: Import from hexadecimal file.
• Save:
• Save: save in .pcapng (wireshark format)
• Save as: Save in different format such that it can be imported to
other network analyzer (.txt, .dmp, .5vw, .erf etc).
16
8
04/10/19
File Menu
• Export :
• File Set: navigate the directory where file will be stored.
• Various Exports OpHons: allow to save report in different format
such as CSV, C array, XML, JSON etc., it also allows to save data
for selected packet or range of packets.
• Print: to print report as a plain text.
• Close and Quit are used to turn off capturing, and exit
from applica8on.
17
Edit Menu
• Edit menu can also be divided into 5 sec8ons:
• Find:
• Used to search packets by matching hexadecimal string, and to search
for next and previous packets as per requirement.
• Mark:
• Mark op8ons are used for marking the packets that are displayed in
summary window.
18
9
04/10/19
Edit Menu
• Preferences: Used to set:-
• How many packets you want to show at once?
• Font and color for packets.
• Fields to be displayed (no, 8me, source, dest. etc.).
19
View Menu
20
10
04/10/19
Go Menu
21
Capture Menu
22
11
04/10/19
Analyze Menu
23
24
12
04/10/19
25
26
13
04/10/19
27
StaHsHcs Menu
28
14
04/10/19
29
30
15
04/10/19
31
Telephony Menu
32
16
04/10/19
Wireless Menu
33
Tools Menu
• This menu is used to select the
rules (which type of scanning do
you want to do).
• It also provides help for various
tools that are used by Wireshark.
34
17
04/10/19
35
Example:
18
04/10/19
Protocol Window
Data Window
37
38
19
04/10/19
Details
You can
switch
between
different
formats
39
40
20
04/10/19
See we
captured
username
and password
41
Making
secure
connecHon
with port 443
42
21
04/10/19
Key exchange
and encrypted
handshaking
processes
between server
and client
43
44
22