Ch 5: Port Scanning

Sam Bowne
Sam BowneInstructor at CCSF
Hands-On Ethical Hacking
and Network Defense
Chapter 5
Port Scanning
Last revised
10-4-17
KonBoot
● Get into any
account
without the
password
● Works on
Windows and
Linux
● No longer free
● Link Ch 5r
From the Projects: UBCD
● Proj 13
● Create new administrator user on a Windows
computer
● Based on Win XP Pre-Boot Environment; causes
BSOD on some modern systems
Linux-Based UBCD
● Proj X7
● Promote normal user to administrator user
on a Windows computer
● Works well on modern systems
Objectives
● Describe port scanning
● Describe different types of port scans
● Describe various port-scanning tools
● Explain what ping sweeps are used for
● Explain how shell scripting is used to
automate security tasks
4
Introduction to Port Scanning
● Port Scanning
● Finds out which services are offered by a host
● Identifies vulnerabilities
● Open services can be used on attacks
● Identify a vulnerable port
● Launch an exploit
● Scan all ports when testing
● Not just well-known ports
5
6
6
6
6
11
Introduction to Port Scanning
(continued)
● Port scanning programs report
● Open ports
● Closed ports
● Filtered ports
● Best-guess assessment of which OS is running
7
Is Port Scanning Legal?
● The legal status of port scanning is unclear
● If you have permission, it's legal
● If you cause damage of $5,000 or more, it
may be illegal
● For more, see links Ch 5a and Ch 5b
8
Normal TCP Handshake
Client SYN ! Server
Client " SYN/ACK Server
Client ACK ! Server
After this, you are ready to send data
9
SYN Port Scan
Client SYN ! Server
Client " SYN/ACK Server
Client RST ! Server
The server is ready, but the client decided
not to complete the handshake 10
Types of Port Scans
● SYN scan
● Stealthy scan, because session handshakes are
never completed
● That keeps it out of some log files
● Three states
● Closed
● Open
● Filtered
11
Types of Port Scans
● Connect scan
● Completes the three-way handshake
● Not stealthy--appears in log files
● Three states
● Closed
● Open
● Filtered
12
Types of Port Scans
● NULL scan
● All the packet flags are turned off
● Two results:
● Closed ports reply with 

RST
● Open or filtered ports give 

no response
13
Types of Port Scans
● XMAS scan
● FIN, PSH and URG flags are set
● Works like a NULL scan – a closed port
responds with an RST packet
● FIN scan
● Only FIN flag is set
● Closed port responds with an RST packet
14
Windows Machines
● NULL, XMAS and FIN scans don't work on
Windows machines
● Win 2000 Pro and Win Server 2003 shows all
ports closed
● Win XP Pro all ports open/filtered
● See the NMAP tutorial (link Ch 5c)
15
Types of Port Scans
● Ping scan
● Simplest method sends ICMP ECHO REQUEST
to the destination(s)
● TCP Ping sends SYN or ACK to any port
(default is port 80 for Nmap)
● Any response shows the target is up
16
Types of Port Scans (continued)
● ACK scan
● Used to get information about a firewall
● Stateful firewalls track connection and block
unsolicited ACK packets
● Stateless firewalls just block incoming SYN packets,
so you get a RST response
● UDP scan
● Closed port responds with ICMP “Port Unreachable”
message
● Rarely used--but much improved in latest Nmap
version (2010)
17
Using Port-Scanning Tools
● Nmap
● Nessus and OpenVAS (the GPL-licensed
fork of Nessus)
● A complete vulnerabilty scanner, more
than a port scanner
23
Nmap
● Originally written for Phrack magazine
● One of the most popular tools
● GUI versions
● Xnmap and Ubuntu's NmapFE
● Open source tool
● Standard tool for security professionals
24
The Matrix Reloaded
● Trinity uses Nmap
● Video at link Ch 4e
25
26
Nessus
● First released in 1998
● No longer free, free version is called
OpenVAS(GreenBone)
● Uses a client/server technology
● Can conduct tests from different locations
● Can use different OSs for client and
network
29
Nessus (continued)
● Finds services running on ports
● Finds vulnerabilities associated with
identified services
32
31
30
OpenVAS (Greenbone)
31
32
Conducting Ping Sweeps
● Ping sweeps
● Identify which IP addresses belong to active
hosts
● Ping a range of IP addresses
● Problems
● Computers that are shut down cannot respond
● Networks may be configured to block ICMP
Echo Requests
● Firewalls may filter out ICMP traffic
34
FPing
● Ping multiple IP addresses simultaneously
● www.fping.com/download
● Command-line tool
● Input: multiple IP addresses
● To enter a range of addresses
● -g option
● Input file with addresses
● -f option
● See links Ch 5k, 5l
35
36
37
Hping
● Used to bypass filtering devices
● Allows users to fragment and manipulate IP
packets
● www.hping.org/download
● Powerful tool
● All security testers must be familiar with tool
● Supports many parameters (command
options)
● See links Ch 5m, Ch 5n
38
39
40
41
Broadcast Addresses
● If you PING a broadcast address, that can
create a lot of traffic
● Normally the broadcast address ends in
255
● But if your LAN is subnetted with a subnet
mask like 255.255.255.192
● There are other broadcast addresses ending in
63, 127, and 191
42
Smurf Attack
● Pinging a broadcast address on an old network
resulted in a lot of ping responses
● So just put the victim's IP address in the "From"
field
● The victim is attacked by a flood of pings, none of them
directly from you
● Modern routers don't forward broadcast packets,
which prevents them from amplifying smurf
attacks
● Windows XP and Ubuntu don't respond to
broadcast PINGs
● See links Ch 5o, 5p 43
Broadcast Ping at CCSF
Crafting IP Packets
● Packet components
● Source IP address
● Destination IP address
● Flags
● Crafting packets helps you obtain more
information about a service
● Tools
● Fping
● Hping
45
Understanding Shell Scripting
● Modify tools to better suit your needs
● Script
● Computer program that automates tasks
● Time-saving solution
46
Scripting Basics
● Similar to DOS batch programming
● Script or batch file
● Text file
● Contains multiple commands
● Repetitive commands are good candidate for
scripting
● Practice is the key
47
48
Scapy
● Packet-crafting python utility
● Proj 9, 10, 17, X11, X12, X13
Python
● Write your own
tools
● Using this book in
CNIT 124
50
1 of 50

Recommended

Port scanning by
Port scanningPort scanning
Port scanningHemanth Pasumarthi
2.7K views14 slides
Nmap basics by
Nmap basicsNmap basics
Nmap basicsitmind4u
13K views16 slides
Nmap and metasploitable by
Nmap and metasploitableNmap and metasploitable
Nmap and metasploitableMohammed Akbar Shariff
2.5K views28 slides
NMAP by
NMAPNMAP
NMAPPrateekAryan1
856 views72 slides
Port Scanning by
Port ScanningPort Scanning
Port Scanningamiable_indian
4.1K views26 slides
Nmap Hacking Guide by
Nmap Hacking GuideNmap Hacking Guide
Nmap Hacking GuideAryan G
1.8K views12 slides

More Related Content

What's hot

Understanding NMAP by
Understanding NMAPUnderstanding NMAP
Understanding NMAPPhannarith Ou, G-CISO
8.1K views23 slides
Network security by
Network securityNetwork security
Network securityEstiak Khan
1.2K views28 slides
Nmap by
NmapNmap
NmapFat-Thing Gabriel-Culley
5.1K views14 slides
Nmap tutorial by
Nmap tutorialNmap tutorial
Nmap tutorialVarun Kakumani
3K views20 slides
Packet sniffing by
Packet sniffingPacket sniffing
Packet sniffingShyama Bhuvanendran
987 views19 slides
Metasploit framwork by
Metasploit framworkMetasploit framwork
Metasploit framworkDeepanshu Gajbhiye
3.9K views42 slides

What's hot(20)

Network security by Estiak Khan
Network securityNetwork security
Network security
Estiak Khan1.2K views
Recon with Nmap by OWASP Delhi
Recon with Nmap Recon with Nmap
Recon with Nmap
OWASP Delhi1.7K views
Network Mapper (NMAP) by KHNOG
Network Mapper (NMAP)Network Mapper (NMAP)
Network Mapper (NMAP)
KHNOG684 views
Firewall Design and Implementation by ajeet singh
Firewall Design and ImplementationFirewall Design and Implementation
Firewall Design and Implementation
ajeet singh11.7K views
System hacking by CAS
System hackingSystem hacking
System hacking
CAS2.6K views
Scanning with nmap by commiebstrd
Scanning with nmapScanning with nmap
Scanning with nmap
commiebstrd2.1K views
Network Penetration Testing by Mohammed Adam
Network Penetration TestingNetwork Penetration Testing
Network Penetration Testing
Mohammed Adam91 views
Password cracking and brute force by vishalgohel12195
Password cracking and brute forcePassword cracking and brute force
Password cracking and brute force
vishalgohel121954.5K views
Packet sniffers by Kunal Thakur
Packet sniffersPacket sniffers
Packet sniffers
Kunal Thakur22.5K views

Viewers also liked

Ch 2: TCP/IP Concepts Review by
Ch 2: TCP/IP Concepts ReviewCh 2: TCP/IP Concepts Review
Ch 2: TCP/IP Concepts ReviewSam Bowne
3.9K views41 slides
Ch 11: Hacking Wireless Networks by
Ch 11: Hacking Wireless NetworksCh 11: Hacking Wireless Networks
Ch 11: Hacking Wireless NetworksSam Bowne
4.8K views89 slides
Ch 12: Cryptography by
Ch 12: CryptographyCh 12: Cryptography
Ch 12: CryptographySam Bowne
3.4K views105 slides
Ch 10: Hacking Web Servers by
Ch 10: Hacking Web ServersCh 10: Hacking Web Servers
Ch 10: Hacking Web ServersSam Bowne
10.3K views76 slides
CNIT 127 Ch 2: Stack overflows on Linux by
CNIT 127 Ch 2: Stack overflows on LinuxCNIT 127 Ch 2: Stack overflows on Linux
CNIT 127 Ch 2: Stack overflows on LinuxSam Bowne
1K views54 slides

Viewers also liked(20)

Ch 2: TCP/IP Concepts Review by Sam Bowne
Ch 2: TCP/IP Concepts ReviewCh 2: TCP/IP Concepts Review
Ch 2: TCP/IP Concepts Review
Sam Bowne3.9K views
Ch 11: Hacking Wireless Networks by Sam Bowne
Ch 11: Hacking Wireless NetworksCh 11: Hacking Wireless Networks
Ch 11: Hacking Wireless Networks
Sam Bowne4.8K views
Ch 12: Cryptography by Sam Bowne
Ch 12: CryptographyCh 12: Cryptography
Ch 12: Cryptography
Sam Bowne3.4K views
Ch 10: Hacking Web Servers by Sam Bowne
Ch 10: Hacking Web ServersCh 10: Hacking Web Servers
Ch 10: Hacking Web Servers
Sam Bowne10.3K views
CNIT 127 Ch 2: Stack overflows on Linux by Sam Bowne
CNIT 127 Ch 2: Stack overflows on LinuxCNIT 127 Ch 2: Stack overflows on Linux
CNIT 127 Ch 2: Stack overflows on Linux
Sam Bowne1K views
Ch 4: Footprinting and Social Engineering by Sam Bowne
Ch 4: Footprinting and Social EngineeringCh 4: Footprinting and Social Engineering
Ch 4: Footprinting and Social Engineering
Sam Bowne2.9K views
CNIT 123 Ch 1: Ethical Hacking Overview by Sam Bowne
CNIT 123 Ch 1: Ethical Hacking OverviewCNIT 123 Ch 1: Ethical Hacking Overview
CNIT 123 Ch 1: Ethical Hacking Overview
Sam Bowne7.9K views
Ch 3: Network and Computer Attacks by Sam Bowne
Ch 3: Network and Computer AttacksCh 3: Network and Computer Attacks
Ch 3: Network and Computer Attacks
Sam Bowne1.7K views
Ch 6: Enumeration by Sam Bowne
Ch 6: EnumerationCh 6: Enumeration
Ch 6: Enumeration
Sam Bowne3.1K views
Ch 13: Network Protection Systems by Sam Bowne
Ch 13: Network Protection SystemsCh 13: Network Protection Systems
Ch 13: Network Protection Systems
Sam Bowne1.9K views
Ch 7: Programming for Security Professionals by Sam Bowne
Ch 7: Programming for Security ProfessionalsCh 7: Programming for Security Professionals
Ch 7: Programming for Security Professionals
Sam Bowne2K views
Network scanning by oceanofwebs
Network scanningNetwork scanning
Network scanning
oceanofwebs3.8K views
CNIT 128 5: Mobile malware by Sam Bowne
CNIT 128 5: Mobile malwareCNIT 128 5: Mobile malware
CNIT 128 5: Mobile malware
Sam Bowne593 views
CNIT 127 Lecture 7: Intro to 64-Bit Assembler (not in book) by Sam Bowne
CNIT 127 Lecture 7: Intro to 64-Bit Assembler (not in book)CNIT 127 Lecture 7: Intro to 64-Bit Assembler (not in book)
CNIT 127 Lecture 7: Intro to 64-Bit Assembler (not in book)
Sam Bowne1.2K views
Nmap(network mapping) by SSASIT
Nmap(network mapping)Nmap(network mapping)
Nmap(network mapping)
SSASIT361 views
CNIT 126 7: Analyzing Malicious Windows Programs by Sam Bowne
CNIT 126 7: Analyzing Malicious Windows ProgramsCNIT 126 7: Analyzing Malicious Windows Programs
CNIT 126 7: Analyzing Malicious Windows Programs
Sam Bowne1.9K views
CNIT 121: 10 Enterprise Services by Sam Bowne
CNIT 121: 10 Enterprise ServicesCNIT 121: 10 Enterprise Services
CNIT 121: 10 Enterprise Services
Sam Bowne675 views
CNIT 127 Ch 6: The Wild World of Windows by Sam Bowne
CNIT 127 Ch 6: The Wild World of WindowsCNIT 127 Ch 6: The Wild World of Windows
CNIT 127 Ch 6: The Wild World of Windows
Sam Bowne1.5K views
CISSP Prep: Ch 3. Asset Security by Sam Bowne
CISSP Prep: Ch 3. Asset SecurityCISSP Prep: Ch 3. Asset Security
CISSP Prep: Ch 3. Asset Security
Sam Bowne2.6K views

Similar to Ch 5: Port Scanning

Black hat dc-2010-egypt-uav-slides by
Black hat dc-2010-egypt-uav-slidesBlack hat dc-2010-egypt-uav-slides
Black hat dc-2010-egypt-uav-slidesBakry3
378 views60 slides
Unmanned Aerial Vehicles: Exploit Automation with the Metasploit Framework by
Unmanned Aerial Vehicles: Exploit Automation with the Metasploit FrameworkUnmanned Aerial Vehicles: Exploit Automation with the Metasploit Framework
Unmanned Aerial Vehicles: Exploit Automation with the Metasploit Frameworkegypt
1.6K views60 slides
Socket Programming using Java by
Socket Programming using JavaSocket Programming using Java
Socket Programming using JavaRahul Hada
2.5K views22 slides
01204427-scanner.ppt by
01204427-scanner.ppt01204427-scanner.ppt
01204427-scanner.pptVarunBehere1
18 views27 slides
Talk@JanusCon2019: Janus, WebRTC and ML - Fantastic technologies and how to m... by
Talk@JanusCon2019: Janus, WebRTC and ML - Fantastic technologies and how to m...Talk@JanusCon2019: Janus, WebRTC and ML - Fantastic technologies and how to m...
Talk@JanusCon2019: Janus, WebRTC and ML - Fantastic technologies and how to m...Paolo Saviano
559 views43 slides
CurveZMQ, ZMTP and other Dubious Characters by
CurveZMQ, ZMTP and other Dubious CharactersCurveZMQ, ZMTP and other Dubious Characters
CurveZMQ, ZMTP and other Dubious Characterspieterh
8.2K views24 slides

Similar to Ch 5: Port Scanning(20)

Black hat dc-2010-egypt-uav-slides by Bakry3
Black hat dc-2010-egypt-uav-slidesBlack hat dc-2010-egypt-uav-slides
Black hat dc-2010-egypt-uav-slides
Bakry3378 views
Unmanned Aerial Vehicles: Exploit Automation with the Metasploit Framework by egypt
Unmanned Aerial Vehicles: Exploit Automation with the Metasploit FrameworkUnmanned Aerial Vehicles: Exploit Automation with the Metasploit Framework
Unmanned Aerial Vehicles: Exploit Automation with the Metasploit Framework
egypt1.6K views
Socket Programming using Java by Rahul Hada
Socket Programming using JavaSocket Programming using Java
Socket Programming using Java
Rahul Hada2.5K views
Talk@JanusCon2019: Janus, WebRTC and ML - Fantastic technologies and how to m... by Paolo Saviano
Talk@JanusCon2019: Janus, WebRTC and ML - Fantastic technologies and how to m...Talk@JanusCon2019: Janus, WebRTC and ML - Fantastic technologies and how to m...
Talk@JanusCon2019: Janus, WebRTC and ML - Fantastic technologies and how to m...
Paolo Saviano559 views
CurveZMQ, ZMTP and other Dubious Characters by pieterh
CurveZMQ, ZMTP and other Dubious CharactersCurveZMQ, ZMTP and other Dubious Characters
CurveZMQ, ZMTP and other Dubious Characters
pieterh8.2K views
St Louis Linux Users Group Wireguard (for Fun and Networking) by Andrew Denner
St Louis Linux Users Group Wireguard (for Fun and Networking)St Louis Linux Users Group Wireguard (for Fun and Networking)
St Louis Linux Users Group Wireguard (for Fun and Networking)
Andrew Denner42 views
Troubleshooting Layer 2 Ethernet Problem: Loop, Broadcast, Security by GLC Networks
Troubleshooting Layer 2 Ethernet Problem: Loop, Broadcast, Security Troubleshooting Layer 2 Ethernet Problem: Loop, Broadcast, Security
Troubleshooting Layer 2 Ethernet Problem: Loop, Broadcast, Security
GLC Networks211 views
Bsdtw17: lightning talks/wip sessions by Scott Tsai
Bsdtw17: lightning talks/wip sessionsBsdtw17: lightning talks/wip sessions
Bsdtw17: lightning talks/wip sessions
Scott Tsai43 views
Building a Small DC by APNIC
Building a Small DCBuilding a Small DC
Building a Small DC
APNIC300 views
Building a Small Datacenter by ssuser4b98f0
Building a Small DatacenterBuilding a Small Datacenter
Building a Small Datacenter
ssuser4b98f04 views
How can OpenNebula fit your needs - OpenNebulaConf 2013 by Maxence Dunnewind
How can OpenNebula fit your needs - OpenNebulaConf 2013 How can OpenNebula fit your needs - OpenNebulaConf 2013
How can OpenNebula fit your needs - OpenNebulaConf 2013
Maxence Dunnewind341 views
Leveraging Android's Linux Heritage at ELC-E 2011 by Opersys inc.
Leveraging Android's Linux Heritage at ELC-E 2011Leveraging Android's Linux Heritage at ELC-E 2011
Leveraging Android's Linux Heritage at ELC-E 2011
Opersys inc.722 views
Using Mikrotik Switch Features to Improve Your Network by GLC Networks
Using Mikrotik Switch Features to Improve Your Network Using Mikrotik Switch Features to Improve Your Network
Using Mikrotik Switch Features to Improve Your Network
GLC Networks418 views
Using Guided Missiles in Drive-bys: Automatic Browser Fingerprinting and Expl... by egypt
Using Guided Missiles in Drive-bys: Automatic Browser Fingerprinting and Expl...Using Guided Missiles in Drive-bys: Automatic Browser Fingerprinting and Expl...
Using Guided Missiles in Drive-bys: Automatic Browser Fingerprinting and Expl...
egypt1.2K views

More from Sam Bowne

Cyberwar by
CyberwarCyberwar
CyberwarSam Bowne
14 views22 slides
3: DNS vulnerabilities by
3: DNS vulnerabilities 3: DNS vulnerabilities
3: DNS vulnerabilities Sam Bowne
40 views40 slides
8. Software Development Security by
8. Software Development Security8. Software Development Security
8. Software Development SecuritySam Bowne
22 views85 slides
4 Mapping the Application by
4 Mapping the Application4 Mapping the Application
4 Mapping the ApplicationSam Bowne
62 views88 slides
3. Attacking iOS Applications (Part 2) by
 3. Attacking iOS Applications (Part 2) 3. Attacking iOS Applications (Part 2)
3. Attacking iOS Applications (Part 2)Sam Bowne
33 views45 slides
12 Elliptic Curves by
12 Elliptic Curves12 Elliptic Curves
12 Elliptic CurvesSam Bowne
51 views50 slides

More from Sam Bowne(20)

3: DNS vulnerabilities by Sam Bowne
3: DNS vulnerabilities 3: DNS vulnerabilities
3: DNS vulnerabilities
Sam Bowne40 views
8. Software Development Security by Sam Bowne
8. Software Development Security8. Software Development Security
8. Software Development Security
Sam Bowne22 views
4 Mapping the Application by Sam Bowne
4 Mapping the Application4 Mapping the Application
4 Mapping the Application
Sam Bowne62 views
3. Attacking iOS Applications (Part 2) by Sam Bowne
 3. Attacking iOS Applications (Part 2) 3. Attacking iOS Applications (Part 2)
3. Attacking iOS Applications (Part 2)
Sam Bowne33 views
12 Elliptic Curves by Sam Bowne
12 Elliptic Curves12 Elliptic Curves
12 Elliptic Curves
Sam Bowne51 views
11. Diffie-Hellman by Sam Bowne
11. Diffie-Hellman11. Diffie-Hellman
11. Diffie-Hellman
Sam Bowne58 views
2a Analyzing iOS Apps Part 1 by Sam Bowne
2a Analyzing iOS Apps Part 12a Analyzing iOS Apps Part 1
2a Analyzing iOS Apps Part 1
Sam Bowne42 views
9 Writing Secure Android Applications by Sam Bowne
9 Writing Secure Android Applications9 Writing Secure Android Applications
9 Writing Secure Android Applications
Sam Bowne31 views
12 Investigating Windows Systems (Part 2 of 3) by Sam Bowne
12 Investigating Windows Systems (Part 2 of 3)12 Investigating Windows Systems (Part 2 of 3)
12 Investigating Windows Systems (Part 2 of 3)
Sam Bowne30 views
12 Investigating Windows Systems (Part 1 of 3 by Sam Bowne
12 Investigating Windows Systems (Part 1 of 312 Investigating Windows Systems (Part 1 of 3
12 Investigating Windows Systems (Part 1 of 3
Sam Bowne59 views
9. Hard Problems by Sam Bowne
9. Hard Problems9. Hard Problems
9. Hard Problems
Sam Bowne43 views
8 Android Implementation Issues (Part 1) by Sam Bowne
8 Android Implementation Issues (Part 1)8 Android Implementation Issues (Part 1)
8 Android Implementation Issues (Part 1)
Sam Bowne23 views
11 Analysis Methodology by Sam Bowne
11 Analysis Methodology11 Analysis Methodology
11 Analysis Methodology
Sam Bowne12 views
8. Authenticated Encryption by Sam Bowne
8. Authenticated Encryption8. Authenticated Encryption
8. Authenticated Encryption
Sam Bowne70 views
7. Attacking Android Applications (Part 2) by Sam Bowne
7. Attacking Android Applications (Part 2)7. Attacking Android Applications (Part 2)
7. Attacking Android Applications (Part 2)
Sam Bowne35 views
7. Attacking Android Applications (Part 1) by Sam Bowne
7. Attacking Android Applications (Part 1)7. Attacking Android Applications (Part 1)
7. Attacking Android Applications (Part 1)
Sam Bowne26 views
5. Stream Ciphers by Sam Bowne
5. Stream Ciphers5. Stream Ciphers
5. Stream Ciphers
Sam Bowne104 views
6 Scope & 7 Live Data Collection by Sam Bowne
6 Scope & 7 Live Data Collection6 Scope & 7 Live Data Collection
6 Scope & 7 Live Data Collection
Sam Bowne120 views

Recently uploaded

Solar System and Galaxies.pptx by
Solar System and Galaxies.pptxSolar System and Galaxies.pptx
Solar System and Galaxies.pptxDrHafizKosar
89 views26 slides
Computer Introduction-Lecture06 by
Computer Introduction-Lecture06Computer Introduction-Lecture06
Computer Introduction-Lecture06Dr. Mazin Mohamed alkathiri
82 views12 slides
Narration ppt.pptx by
Narration  ppt.pptxNarration  ppt.pptx
Narration ppt.pptxTARIQ KHAN
131 views24 slides
The Open Access Community Framework (OACF) 2023 (1).pptx by
The Open Access Community Framework (OACF) 2023 (1).pptxThe Open Access Community Framework (OACF) 2023 (1).pptx
The Open Access Community Framework (OACF) 2023 (1).pptxJisc
107 views7 slides
American Psychological Association 7th Edition.pptx by
American Psychological Association  7th Edition.pptxAmerican Psychological Association  7th Edition.pptx
American Psychological Association 7th Edition.pptxSamiullahAfridi4
82 views8 slides
ICS3211_lecture 08_2023.pdf by
ICS3211_lecture 08_2023.pdfICS3211_lecture 08_2023.pdf
ICS3211_lecture 08_2023.pdfVanessa Camilleri
127 views30 slides

Recently uploaded(20)

Solar System and Galaxies.pptx by DrHafizKosar
Solar System and Galaxies.pptxSolar System and Galaxies.pptx
Solar System and Galaxies.pptx
DrHafizKosar89 views
Narration ppt.pptx by TARIQ KHAN
Narration  ppt.pptxNarration  ppt.pptx
Narration ppt.pptx
TARIQ KHAN131 views
The Open Access Community Framework (OACF) 2023 (1).pptx by Jisc
The Open Access Community Framework (OACF) 2023 (1).pptxThe Open Access Community Framework (OACF) 2023 (1).pptx
The Open Access Community Framework (OACF) 2023 (1).pptx
Jisc107 views
American Psychological Association 7th Edition.pptx by SamiullahAfridi4
American Psychological Association  7th Edition.pptxAmerican Psychological Association  7th Edition.pptx
American Psychological Association 7th Edition.pptx
SamiullahAfridi482 views
Are we onboard yet University of Sussex.pptx by Jisc
Are we onboard yet University of Sussex.pptxAre we onboard yet University of Sussex.pptx
Are we onboard yet University of Sussex.pptx
Jisc93 views
Drama KS5 Breakdown by WestHatch
Drama KS5 BreakdownDrama KS5 Breakdown
Drama KS5 Breakdown
WestHatch73 views
Lecture: Open Innovation by Michal Hron
Lecture: Open InnovationLecture: Open Innovation
Lecture: Open Innovation
Michal Hron99 views
Education and Diversity.pptx by DrHafizKosar
Education and Diversity.pptxEducation and Diversity.pptx
Education and Diversity.pptx
DrHafizKosar135 views
Scope of Biochemistry.pptx by shoba shoba
Scope of Biochemistry.pptxScope of Biochemistry.pptx
Scope of Biochemistry.pptx
shoba shoba126 views
REPRESENTATION - GAUNTLET.pptx by iammrhaywood
REPRESENTATION - GAUNTLET.pptxREPRESENTATION - GAUNTLET.pptx
REPRESENTATION - GAUNTLET.pptx
iammrhaywood91 views
Community-led Open Access Publishing webinar.pptx by Jisc
Community-led Open Access Publishing webinar.pptxCommunity-led Open Access Publishing webinar.pptx
Community-led Open Access Publishing webinar.pptx
Jisc91 views
The Accursed House by Émile Gaboriau by DivyaSheta
The Accursed House  by Émile GaboriauThe Accursed House  by Émile Gaboriau
The Accursed House by Émile Gaboriau
DivyaSheta187 views
Psychology KS4 by WestHatch
Psychology KS4Psychology KS4
Psychology KS4
WestHatch76 views
Structure and Functions of Cell.pdf by Nithya Murugan
Structure and Functions of Cell.pdfStructure and Functions of Cell.pdf
Structure and Functions of Cell.pdf
Nithya Murugan455 views

Ch 5: Port Scanning

  • 1. Hands-On Ethical Hacking and Network Defense Chapter 5 Port Scanning Last revised 10-4-17
  • 2. KonBoot ● Get into any account without the password ● Works on Windows and Linux ● No longer free ● Link Ch 5r
  • 3. From the Projects: UBCD ● Proj 13 ● Create new administrator user on a Windows computer ● Based on Win XP Pre-Boot Environment; causes BSOD on some modern systems
  • 4. Linux-Based UBCD ● Proj X7 ● Promote normal user to administrator user on a Windows computer ● Works well on modern systems
  • 5. Objectives ● Describe port scanning ● Describe different types of port scans ● Describe various port-scanning tools ● Explain what ping sweeps are used for ● Explain how shell scripting is used to automate security tasks 4
  • 6. Introduction to Port Scanning ● Port Scanning ● Finds out which services are offered by a host ● Identifies vulnerabilities ● Open services can be used on attacks ● Identify a vulnerable port ● Launch an exploit ● Scan all ports when testing ● Not just well-known ports 5
  • 7. 6
  • 8. 6
  • 9. 6
  • 10. 6
  • 11. 11
  • 12. Introduction to Port Scanning (continued) ● Port scanning programs report ● Open ports ● Closed ports ● Filtered ports ● Best-guess assessment of which OS is running 7
  • 13. Is Port Scanning Legal? ● The legal status of port scanning is unclear ● If you have permission, it's legal ● If you cause damage of $5,000 or more, it may be illegal ● For more, see links Ch 5a and Ch 5b 8
  • 14. Normal TCP Handshake Client SYN ! Server Client " SYN/ACK Server Client ACK ! Server After this, you are ready to send data 9
  • 15. SYN Port Scan Client SYN ! Server Client " SYN/ACK Server Client RST ! Server The server is ready, but the client decided not to complete the handshake 10
  • 16. Types of Port Scans ● SYN scan ● Stealthy scan, because session handshakes are never completed ● That keeps it out of some log files ● Three states ● Closed ● Open ● Filtered 11
  • 17. Types of Port Scans ● Connect scan ● Completes the three-way handshake ● Not stealthy--appears in log files ● Three states ● Closed ● Open ● Filtered 12
  • 18. Types of Port Scans ● NULL scan ● All the packet flags are turned off ● Two results: ● Closed ports reply with 
 RST ● Open or filtered ports give 
 no response 13
  • 19. Types of Port Scans ● XMAS scan ● FIN, PSH and URG flags are set ● Works like a NULL scan – a closed port responds with an RST packet ● FIN scan ● Only FIN flag is set ● Closed port responds with an RST packet 14
  • 20. Windows Machines ● NULL, XMAS and FIN scans don't work on Windows machines ● Win 2000 Pro and Win Server 2003 shows all ports closed ● Win XP Pro all ports open/filtered ● See the NMAP tutorial (link Ch 5c) 15
  • 21. Types of Port Scans ● Ping scan ● Simplest method sends ICMP ECHO REQUEST to the destination(s) ● TCP Ping sends SYN or ACK to any port (default is port 80 for Nmap) ● Any response shows the target is up 16
  • 22. Types of Port Scans (continued) ● ACK scan ● Used to get information about a firewall ● Stateful firewalls track connection and block unsolicited ACK packets ● Stateless firewalls just block incoming SYN packets, so you get a RST response ● UDP scan ● Closed port responds with ICMP “Port Unreachable” message ● Rarely used--but much improved in latest Nmap version (2010) 17
  • 23. Using Port-Scanning Tools ● Nmap ● Nessus and OpenVAS (the GPL-licensed fork of Nessus) ● A complete vulnerabilty scanner, more than a port scanner 23
  • 24. Nmap ● Originally written for Phrack magazine ● One of the most popular tools ● GUI versions ● Xnmap and Ubuntu's NmapFE ● Open source tool ● Standard tool for security professionals 24
  • 25. The Matrix Reloaded ● Trinity uses Nmap ● Video at link Ch 4e 25
  • 26. 26
  • 27. Nessus ● First released in 1998 ● No longer free, free version is called OpenVAS(GreenBone) ● Uses a client/server technology ● Can conduct tests from different locations ● Can use different OSs for client and network 29
  • 28. Nessus (continued) ● Finds services running on ports ● Finds vulnerabilities associated with identified services 32
  • 29. 31
  • 31. 31
  • 32. 32
  • 33. Conducting Ping Sweeps ● Ping sweeps ● Identify which IP addresses belong to active hosts ● Ping a range of IP addresses ● Problems ● Computers that are shut down cannot respond ● Networks may be configured to block ICMP Echo Requests ● Firewalls may filter out ICMP traffic 34
  • 34. FPing ● Ping multiple IP addresses simultaneously ● www.fping.com/download ● Command-line tool ● Input: multiple IP addresses ● To enter a range of addresses ● -g option ● Input file with addresses ● -f option ● See links Ch 5k, 5l 35
  • 35. 36
  • 36. 37
  • 37. Hping ● Used to bypass filtering devices ● Allows users to fragment and manipulate IP packets ● www.hping.org/download ● Powerful tool ● All security testers must be familiar with tool ● Supports many parameters (command options) ● See links Ch 5m, Ch 5n 38
  • 38. 39
  • 39. 40
  • 40. 41
  • 41. Broadcast Addresses ● If you PING a broadcast address, that can create a lot of traffic ● Normally the broadcast address ends in 255 ● But if your LAN is subnetted with a subnet mask like 255.255.255.192 ● There are other broadcast addresses ending in 63, 127, and 191 42
  • 42. Smurf Attack ● Pinging a broadcast address on an old network resulted in a lot of ping responses ● So just put the victim's IP address in the "From" field ● The victim is attacked by a flood of pings, none of them directly from you ● Modern routers don't forward broadcast packets, which prevents them from amplifying smurf attacks ● Windows XP and Ubuntu don't respond to broadcast PINGs ● See links Ch 5o, 5p 43
  • 44. Crafting IP Packets ● Packet components ● Source IP address ● Destination IP address ● Flags ● Crafting packets helps you obtain more information about a service ● Tools ● Fping ● Hping 45
  • 45. Understanding Shell Scripting ● Modify tools to better suit your needs ● Script ● Computer program that automates tasks ● Time-saving solution 46
  • 46. Scripting Basics ● Similar to DOS batch programming ● Script or batch file ● Text file ● Contains multiple commands ● Repetitive commands are good candidate for scripting ● Practice is the key 47
  • 47. 48
  • 48. Scapy ● Packet-crafting python utility ● Proj 9, 10, 17, X11, X12, X13
  • 49. Python ● Write your own tools ● Using this book in CNIT 124
  • 50. 50