Lecture 2 Scanning
Lecture 2 Scanning
vulnerabilities
and penetration
testing
Dr Phillip James
Last week we considered reconnaissance:
Recap and • Footprinting
today • Active vs passive
• Everyday activities like phone/email
• Whois/DNS/Ping
• Google hacking
Result:
ssh
http
ssh
ftp
ssh
smtp
The setup
Firewall
(Prevention)
Four core network technologies:
Technologies
available UDP: primarily for establishing low-latency and
loss-tolerating connections between applications
on the internet.
IP
Internet protocol
Example:
194.24.8.0/22
Network address is 194.24.8.0
Subnet mask is 22 1s then 10 0s
So, 210, ie 1024, addresses in this network.
Routing tables holds entries of form:
(Network address, subnet mask, link)
CIDR
Routing steps:
Classless Interdomain Routing • Bitwise AND destination IP of incoming packet
with each subnet mask...
• Compare result with corresponding network
address: match? Send packet there...
• If multiple entries match, pick the one with the
longest netmask.
• Bitwise AND is just a way to say “is this host in
this network’s range?”
Example
routing
Application data
(message)
• Stateful, reliable, connection-oriented.
• Full duplex service.
TCP • 3-way handshake to establish connection.
• TCP code can buffer bytes, rather than sending
Transmission control protocol immediately.
Rely on me 32 bits
Options
Data
TCP flags for the basis for most scans:
SYN/ACK
ACK
...
FIN/ACK
ACK
FIN/ACK
ACK
Tools and scans
nmap
• Host discovery
• Port discovery / enumeration
• Service discovery
• Operating system version detection
• Hardware (MAC) address detection
• Vulnerability / exploit detection, using Nmap
scripts (NSE)
nmap -sP 10.0.0.0/24
(ping scan given network range)
Selected
examples nmap -v -sS -A -T4 <target>
(verbose, stealth syn scan, OS detection, timelimit
10ms (aggresive))
scan RST
RST
SYN
hping3 –V …
(add verbose output)
Ack scan
hping3 -c <packet_count> -p <port> -A <target>
Advanced Used to see if a host is alive (when Ping is blocked for example). This
scans should send a RST response back if the port is open.
Smurf Attack
hping3 -1 --flood –a <target_ip> <broadcast_network_address>
Floods a target system via spoofed broadcast ping messages.