chapter 03
chapter 03
Engineering
Chap04: System Pentesting: Password Cracking, Escalating Privileges, and Hiding Files
33 OBJECTIVES COVERED IN T H I S C H AP
07 Understand war-dialing
08 Understand banner
04 Understand DNS
enumeration
10 What is
enumeration?
05 Understand nmap
command switches
11 What is meant by
null sessions?
SNMP enumeration ?
Scanning
33 Scanning is the process of locating systems that are alive and responding on the network.
Ethical hackers use scanning to identify target systems’ IP addresses. Scanning is also
used to determine whether a system is on the network and available. Scanning tools are
used to gather information about a system such as IP addresses, the operating system,
and services running on the target computer
Scanning Methodology
33
Draw
Check for Service Network Attack
Live Systems Identification Diagrams
1 3 5 7
2 4 6
33 Also known as Internet Control Message Protocol (ICMP) scanning, as ICMP is the
protocol used by the ping command, it is the process of sending an ICMP request or
ping to all hosts on the network to determine which ones are up and responding to
pings
A benefit of ICMP scanning is that it can be run in parallel, meaning all systems are
scanned at the same time
Personal firewall software and network-based firewalls can block a system from
responding to ping sweeps
33 Port scanning is the method used to check for open ports. The process of port
scanning involves probing each port on a host to determine which ports are open.
Port scanning generally yields more valuable information than a ping sweep about
the host and vulnerabilities on the system
SYN Synchronize. Initiates a connection between URG Urgent. Data in packets must be processed
hosts. quickly.
ACK Acknowledge. Established connection between FIN Finish. No more transmissions.
hosts. RST Reset. Resets the connection
PSH Push. System is forwarding buffered data.
Gathering Network and Host Information:
Chap
Chap Scanning and Enumeration
NMAP
33 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
SYN
FIN+PSH+URG
SYN+AC
K
No Response
ACK
RST
SYN FIN+PSH+URG
RST RST
Gathering Network and Host Information:
Chap
Chap Scanning and Enumeration
NMAP
SYN+AC
K No Response
RST
SYN No Flags
+PORT
RST RST
Gathering Network and Host Information:
Chap
Chap Scanning and Enumeration
NMAP
33
TARGET SPECIFICATION
Switch Example Description
nmap 192.168.1.1 Scan a single IP
33
SCAN TECHNIQUES
-sS nmap 192.168.1.1 -sS TCP SYN port scan (Default)
-sT nmap 192.168.1.1 -sT TCP connect port scan
-sU nmap 192.168.1.1 -sU UDP port scan
-sA nmap 192.168.1.1 -sA TCP ACK port scan
-sW nmap 192.168.1.1 -sW TCP Window port scan
-sM nmap 192.168.1.1 -sM TCP Maimon port scan
Gathering Network and Host Information:
Chap
Chap Scanning and Enumeration
33
HOST DISCOVERY
-sL nmap 192.168.1.1-3 -sL No Scan. List targets only
Disable port scanning. Host
-sn nmap 192.168.1.1/24 -sn discovery only.
33
PORT SPECIFICATION
-p nmap 192.168.1.1 -p 21 Port scan for port x
-p nmap 192.168.1.1 -p 21-100 Port range
nmap 192.168.1.1 -p U:53,T:21- Port scan multiple TCP and UDP
-p
25,80 ports
-p- nmap 192.168.1.1 -p- Port scan all ports
33
OS DETECTION
33
FIREWALL / IDS EVASION AND SPOOFING
Requested scan (including ping scans)
-f nmap 192.168.1.1 -f use tiny fragmented IP packets.
Harder for packet filters
nmap -D 192.168.1.101,192.168.1.102,
-D Send scans from spoofed IPs
192.168.1.103,192.168.1.23 192.168.1.1
nmap -D decoy-ip1,decoy-ip2,your-own-ip,decoy-
-D Above example explained
ip3,decoy-ip4 remote-host-ip
33 Prequisites:
- Kali-Linux VM
- Windows 7 VM
33 Prequisites:
- Kali-Linux VM , Windows 7 VM:
Steps:
2.Enter the IP address of the target system in the Host or IP Address field
or enter a range or IP address for your lab systems and click Start to
perform a conventional (full connect) scan of standard ports
Gathering Network and Host Information:
Chap
Chap Scanning and Enumeration
Hackers are looking for the easiest way to gain access to a system or network.
Banner grabbing is the process of opening a connection and reading the banner or
response sent by the application.
A simple but effective passive method is to inspect the initial Time To Live (TTL) in
the IP header and the TCP window size (the size of the receive window) of the first
packet in a TCP session, i.e. the SYN or SYN+ACK packet.
33 Prequisites:
- Kali-Linux VM , Windows 7 VM:
Steps:
- Start Windows 7 VM
- Start Kali-linux VM
- choose ICMP echo reply line from used ip address and in Internet Protocol you can view
33
Exercise 3.5.1: using wappalyzer plugin
Part 1: use wappalyzer plugin to Identify the OS of a Web Server
shorturl.at/hS012
Gathering Network and Host Information:
net view \\<computername>
Chap
Chap Scanning and Enumeration
33
Enumeration
Enumeration occurs after scanning and is the process of gathering and
compiling user-names, machine names, network resources, shares, and
services.
33 Prequisites:
- Local machine , Windows 7 VM:
Steps:
- Analyse the traffic with Wireshark and you can get ip address of hosts in network
33 PREQUISITES:
- Kali VM , West-WildVM
https://download.vulnhub.com/westwild/West-Wild-v1.1.ova
STEPS:
NT_STATUS_OBJECT_NAME_NOT_FOUND listing \*
root@kali:~# smbclient //192.168.227.138/wave
Enter WORKGROUP\root's password:
Anonymous login successful
Try "help" to get a list of possible commands.
smb: \> ls
. D 0 Tue Jul 30 01:18:56 2019
.. D 0 Thu Aug 1 19:02:20 2019
FLAG1.txt N 93 Mon Jul 29 22:31:05 2019
message_from_aveng.txt N 115 Tue Jul 30 01:21:48 2019
getting file \FLAG1.txt of size 93 as FLAG1.txt (22.7 KiloBytes/sec) (average 22.7 KiloBytes/sec)
Gathering Network and Host Information:
Chap Scanning and Enumeration
3
NMAP
NMAP VULNERABILITY SCAN USING NSE SCRIPTS
25
Gathering Network and Host Information:
Chap Scanning and Enumeration
nmap-vulners
Vulscan
NMAP VULSCAN
Vulscan interroge ses propres bases de données CVE locales, hébergées sur le client effectuant l'analyse. Ces bases
de données locales incluent les fichiers suivants
scipvuldb.csv - https://vuldb.com
cve.csv - https://cve.mitre.org
securityfocus.csv - https://www.securityfocus.com/bid/
xforce.csv - https://exchange.xforce.ibmcloud.com/
expliotdb.csv - https://www.exploit-db.com
openvas.csv - http://www.openvas.org
securitytracker.csv - https://www.securitytracker.com (end-of-life)
osvdb.csv - http://www.osvdb.org (end-of-life)
Installation
--script-args vulscandb=your_own_database
Gathering Network and Host Information:
Chap 3 Scanning and Enumeration
https://www.computec.ch/projekte/vulscan/download/cve.csv
https://www.computec.ch/projekte/vulscan/download/exploitdb.csv
https://www.computec.ch/projekte/vulscan/download/openvas.csv
https://www.computec.ch/projekte/vulscan/download/osvdb.csv
https://www.computec.ch/projekte/vulscan/download/scipvuldb.csv
https://www.computec.ch/projekte/vulscan/download/securityfocus.csv
https://www.computec.ch/projekte/vulscan/download/securitytracker.csv
https://www.computec.ch/projekte/vulscan/download/xforce.csv
/vulscan/
Gathering Network and Host Information:
Chap 3 Scanning and Enumeration
NMAP-VULNERS
Nmap-vulners est l'un des scanners de vulnérabilité les plus connus en cours d'utilisation
Installation
cd /usr/share/nmap/scripts/
git clone https://github.com/vulnersCom/nmap-vulners.git
Utilisation
Metasploitable 2
Chap
Netcat Basic command
3 Port Scanning
Netcat can be used as a port scanner, although it was not designed to function as. To
make it worth as a scanner, we need to set the “-z” flag, which tells netcat, to scan listing
daemon without sending any data. This makes it possible to understand the type of
service that is running on that specific port. Thus netcat can perform both the TCP and the
UDP scan
TCP Scan
nc -v –n –z 192.168.1.105 21-100
UDP Scan
nc –vzu 192.168.1.105 161
3 Banner Grabbing
Banner refers to a text message received from the host with information about the open ports and
services along with their version numbers.
Run the following command to grab the target’s ftp and ssh banners:
nc 192.168.1.105 21
nc 192.168.1.105 22
Chap
PowerShell | IPv4 network scanner
3 Link:
https://github.com/BornToBeRoot/PowerShell_IPv4NetworkScanner
Example 1
Example 2
3 Link:
https://github.com/BornToBeRoot/PowerShell_IPv4PortScanner
33 PREQUISITES:
- Kali VM
Test SCAN
33
PREQUISITES:
- Kali VM
INSTALLATION:
http://127.0.0.1:8000
Gathering Network and Host Information:
Chap 3 Scanning and Enumeration
LAB ENVIRONMENT
Vmware Workstation
Kali-linux
Gathering Network and Host Information:
Chap 3 Scanning and Enumeration
- Download GreenBone VM :
https://files.greenbone.net/download/delivery/5535f51d-0aff-41de-b8d3-d426f4d21918/GSM-
TRIAL-21.04.12-VMware-Workstation.ova
- Log in using the following login information: User name: admin | Password: admin
- (webadmin:123456)
Gathering Network and Host Information:
Chap
Chap Scanning and Enumeration
33
Gathering Network and Host Information:
Chap
Chap Scanning and Enumeration
33
Gathering Network and Host Information:
Chap
Chap Scanning and Enumeration
33
Gathering Network and Host Information:
Chap
Chap Scanning and Enumeration
33
Gathering Network and Host Information:
Chap
Chap Scanning and Enumeration
33 A.
B.
C.
D.
21
25
23
80
2. What port number does HTTPS use?
A. 80
B. 443
C. 22
3. Banner grabbing is an example of what?
A. Active operating system fingerprinting.
B. Passive operating system fingerprinting
C. Footprinting
D. Application analysis
5. What is enumeration?
8. To prevent a hacker from using SMB session hijacking, which TCP and
UDP ports would you block at the firewall??
A. 167 and 137
B. 80 and 23
C. 139 and 445
D. 1277 and 1270