Chapter 3 - Scanning and Enumeration (Scanning Networks) Flashcards
Definitions
Scanning
Footprinting
Scanning - discovering systems on the network and taking a look at what open ports and applications may be running
Footprinting - learning how big the network is and general information about its makeup
Definitions
Frame
Packet
Segment
Layer 2, includes physical addresses
Layer 3, includes network address
Layer 4, aka Protocol Data Unit
Definition
User Datagram Protocol (UDP)
Layer 4, Transport, Protocol
Connectionless
examples: TFTP, DNS, DHCP
6 TCP Flags that can be set in the TCP Header
SYN ACK RST FIN PSH URG
SYN - Synchronize
ACK - Acknowledgement
RST - Reset. Forces termination in both directions
FIN - Finish. Ordered close to communications
PSH - Push. Forces delivery, ignores buffering
URG - Urgent. Data inside being sent out of band. ie cancelling a message mid-stream
Know what protocols use these ports
20-21 22 23 25 53 67 69 80
20 and 21 - FTP (TCP) 22 - SSH (TCP) 23 - Telnet (TCP) 25 - SMTP (TCP) 53 - DNS (TCP and UDP) 67 - DHCP (UDP) 69 - TFTP (UDP) 80 - HTTP (TCP)
Know what protocols use these ports
110 135 137-139 143 161-162 389 443 445
110 - POP3 (TCP) 135 - RPC (TCP) 137-139 NetBIOS (TCP and UDP) 143 - IMAP (TCP) 161-162 SNMP (UDP) 389 - LDAP (TCP and UDP) 443 - HTTPS (TCP) 445 - SMB (TCP)
Difference between these 2 types of port states
CLOSE_WAIT
TIME_WAIT
CLOSE_WAIT - remote side of connection closed connection
TIME_WAIT - local (your) side closed the connection
Two types of broadcast addresses
Limited Broadcast
Directed Broadcast
Limited Broadcast addresses are delivered to every system inside the broadcast domain and use 255.255.255.255. (dest. MAC FF:FF:FF:FF:FF:FF)
Directed Broadcasts are sent to all devices on a subnet and use the subnet’s broadcast address. Routers may take action on these packets.
7 Steps of EC Scanning Methodology
Check for live systems Check for open ports Scan beyond IDS Perform Banner Grabbing Scan for vulnerabilities Draw network diagrams Prepare proxies
Check for live systems - simple ping can provide this. Tells you what responds on network
Check for open ports - find listening ports on live systems
Scan beyond IDS - may need to alter your scans to avoid IDS devices
Perform Banner Grabbing - This and OS fingerprinting tell what OS is on the system, what services they run
Scan for vulnerabilities - Perform more focused look at vulnerabilities that haven’t been patched
Draw network diagrams - display all logical and physical pathways to targets
Prepare proxies - obscure your efforts to stay hidden
ICMP Message Types
0: Echo Reply
3: Destination Unreachable
4: Source Quench
5: Redirect
8: Echo Request
9: Time Exceeded
0: Echo Reply - answer to Type 8
3: Destination Unreachable - error message indicating host or network can’t be reached. 7 codes used
4: Source Quench - congestion control message
5: Redirect - when 2 or more gateways available and the best route is not the configured gateway
8: Echo Request - ping message requesting echo reply
9: Time Exceeded - packet took too long (Code 0 TTL expired)
ICMP Message Types
0: Echo Reply
3: Destination Unreachable
4: Source Quench
5: Redirect
8: Echo Request
9: Time Exceeded
0: Echo Reply - answer to Type 8
3: Destination Unreachable - error message indicating host or network can’t be reached. 7 codes used (know code 13 - communication administratively prohibited. ie blocked by firewall)
4: Source Quench - congestion control message
5: Redirect - when 2 or more gateways available and the best route is not the configured gateway
8: Echo Request - ping message requesting echo reply
9: Time Exceeded - packet took too long (Code 0 TTL expired)
Full Connect Port Scan 1
aka TCP connect or full open scan
runs through full connection (3 way handshake) on all ports, tearing it down with RST at the end.
Easiest to detect, probably the most reliable
open ports respond with SYN/ACK
closed ports respond with RST
Port Scan 1
Full Connect aka TCP connect or full open scan
runs through full connection (3 way handshake) on all ports, tearing it down with RST at the end.
Easiest to detect, probably the most reliable
open ports respond with SYN/ACK
closed ports respond with RST
Port Scan 2
Stealth aka half-open or SYN scan
Only SYN packets are sent to ports, no full 3-way handshake ever occurs
Responses are same as for the TCP connect scan
Useful for hiding your scanning efforts, possibly bypassing firewalls and monitoring by hiding as normal traffic
Doesn’t get noticed because no connection to notice
Port Scan 3
Inverse TCP Flag
Uses FIN, URG, PSH flag or no flag at all to poke system ports
If port is open, there will be no response.
If port is closed, RST/ACK will be sent in response