Week 4
Week 4
Topic
Lecture 16: Software Installation and Network Setup
NPTEL
1
2/9/2022
• DISCLAIMER – Learners of this course must not use any vulnerable machines
available on the internet.
• If any LEGAL action is taken against them, then NPTEL / IIT KHARAGPUR will not be
responsible.
• NOTE: Keep your system firewall turned on while practicing.
NPTEL
a) Hypervisor Software
• VMware, VirtualBox
b) Attacker System
• Kali Linux ISO, Parrot Security, Backbox, etc.
c) Victim System
• Windows XP, Windows 7
• Metasploitable machines (Metasploitable 2 and Metasploitable 3)
2
2/9/2022
• We shall download and install the latest version of virtual box from:
https://www.virtualbox.org/wiki/Downloads
NPTEL
3
2/9/2022
• We can also install some older machines such as Windows XP for practice.
NPTEL
4
2/9/2022
NPTEL
Alternatives
10
5
2/9/2022
11
NPTEL
Topic
Lecture 17: Information Gathering (Part 1)
6
2/9/2022
NPTEL
14
7
2/9/2022
Objectives of Reconnaissance
• Collect network information:
• Domain name, IP addresses, internal domain name, services running (TCP, UDP).
15
NPTEL
Passive Reconnaissance
16
8
2/9/2022
Active Reconnaissance
17
NPTEL
• In archive.org website we can get complete history of any website like when it
was last updated.
• We can go back to the particular date and observe the webpage.
• We can mirror the website which will load all the files locally, such as HTML
codes, images etc. that can be used to observe the directories used.
18
9
2/9/2022
• Whois database lookup allows us to access many useful information about target
such as:
• Registration details
• IP address
• Contact number and Email ID
• Domain owner
• Name servers
• Regional Internet Registries
19
NPTEL
20
10
2/9/2022
• We can also extract some information from search engine cache and internet
archives.
21
NPTEL
22
11
2/9/2022
23
NPTEL
• We can register and opt for alerts to know all updates about a company
/organization.
• If we are analyzing social media accounts then we can follow the targeted person
/ organization to get all new updates.
• We can even look into groups, forums, and blogs.
• Simple browsing of the website can identify the software, database used, etc.
24
12
2/9/2022
25
NPTEL
26
13
2/9/2022
Topic
Lecture 18: Information Gathering (Part 2)
NPTEL
14
2/9/2022
• Tools used:
• nslookup, host, dig, etc.
29
NPTEL
30
15
2/9/2022
• Open ports
• Service running in some particular port every port with associated application
31
NPTEL
• NMAP is a free, open-source tool for vulnerability scanning and network discovery.
• Generic command to run NMAP on command prompt:
nmap [scan types] [options] <host or network ...>
32
16
2/9/2022
33
NPTEL
No response
Scanner TARGET is down/filtered Target
34
17
2/9/2022
nmap -PE -sn " " -> PE if for ICMP sweep and -sn is for not scanning open ports'
nmap -PE -sn "" --reason --packet-trace -> if the reason was checking ARP cache then it did perform ICMP sweep
35
NPTEL
(b) Host discovery using Broadcast ICMP • Most routers block this.
• Windows ignore these
requests.
• How it works?
• Send out an ICMP ECHO request to the network and/or broadcast address.
• All the hosts in the network will simultaneously send back ICMP ECHO reply packets.
• Faster than previous method.
Scanner
36
18
2/9/2022
• 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 2: Send ICMP type 17 messages (ADDRESS MASK REQUEST) (-PM option)
• The scanner queries subnet mask to the target (this feature is used by diskless workstations
during booting).
37
NPTEL
38
19
2/9/2022
39
NPTEL
40
20
2/9/2022
41
NPTEL
42
21
2/9/2022
43
NPTEL
Topic
Lecture 19: Port Scanning Using NMAP
22
2/9/2022
NPTEL
46
23
2/9/2022
Client Server
(a) TCP Connect scan SYN
• How it works?
SYN/ACK
• Use basic TCP connection establishment mechanism.
• Complete 3-way handshake.
ACK
• Easy to detect by inspecting the system log.
SYN Connection
Established
SYN/ACK
ACK
Scanner Target
The port is OPEN
SYN
RST/ACK
47
NPTEL
48
24
2/9/2022
Client Server
(b) TCP SYN scan SYN
• How it works?
• Do not establish complete connection (half-open scanning). SYN/ACK
• SYN/ACK is received The port is LISTENING
• Immediately terminate connection by sending RST. ACK
• RST/ACK is received The port is NON-LISTENING
Connection
• The -sT scan uses both TCP SYN and TCP ACK packets. Established
• It also uses ICMP ECHO sweep for checking if host is up or not.
SYN
SYN/ACK
RST
Scanner Target
The port is OPEN
SYN
RST/ACK
49
Scanner The port is CLOSED Target
NPTEL
50
25
2/9/2022
• Basic idea:
• Carry out port scanning while avoiding detection.
• 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.
51
NPTEL
Probe packet
No response
52
26
2/9/2022
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 connection
53
NPTEL
54
27
2/9/2022
55
NPTEL
Topic
Lecture 20: Other Features of NMAP
28
2/9/2022
NPTEL
58
29
2/9/2022
59
NPTEL
• By default NMAP uses all types of sweep operations in common scanning options
such that it can get better details about any system.
• Commands that use all types (except UDP sweep) are -sP, -sn, -sl, -Pn, etc.
• We will show example of -sP command.
• This is used to print whether all or specific hosts are up and running.
60
30
2/9/2022
61
NPTEL
62
31
2/9/2022
63
NPTEL
nmap -sT "" "" -> can give IP addresses separated by space
(OR) 192.168.23.13-250 (scans IP addresses from ending in 13 to ending in 250)
64
32
2/9/2022
65
NPTEL
Reconnaissance Countermeasures
• Some steps can be taken to prevent reconnaissance such as:
• Do not release critical info publically.
• Use footprint techniques to discover and remove sensitive information.
• Use split DNS, and restrict zone transfer.
• Disable directory listing.
• Educate employee about various social engineering attacks.
• Encrypt password and sensitive information
• Keep your system updated.
• Use server mask
66
33
2/9/2022
67
NPTEL
68
34