Network Discovery
Table of Contents
Network Discovery
Description
Network Discovery is a core component of Active Reconnaissance in a penetration test or vulnerability assessment. Its purpose is to build a comprehensive picture of the network topology, which guides subsequent attack or defense strategies. By actively sending packets to targets, an analyst can infer a wealth of information about the hosts.
Key Information Gathered
- Host Identification: Determining which IP addresses correspond to active devices (hosts).
- Port Scanning: Identifying which TCP and UDP ports are open, indicating running services.
- Service Enumeration: Identifying the specific application and version running behind an open port (e.g., Apache 2.4.x, OpenSSH 7.2p2).
- Operating System Fingerprinting: Guessing the operating system (OS) of the host based on subtle differences in how it responds to specific packets (e.g., TCP window size, default Time-To-Live/TTL value).
Discovery Techniques
Network discovery relies on protocols at various layers of the OSI model:
- ARP Scanning (Layer 2): Used for fast host discovery on a local network segment (LAN). It sends ARP requests and listens for replies to map IP addresses to MAC addresses.
- ICMP Scanning (Layer 3): Used to check if a remote host is alive by sending ICMP Echo Request (ping) and waiting for an ICMP Echo Reply. This is often blocked by firewalls.
- TCP/UDP Scanning (Layer 4): This involves sending TCP SYN packets (for SYN scans or "half-open" scans) or UDP packets to ports to determine their state (open, closed, or filtered).
Examples
ARP Scan Command (Local Discovery): To quickly find all active devices on the local subnet using the Address Resolution Protocol (ARP), which is typically faster and stealthier than ping sweeps on a LAN:
# Command using the arp-scan tool on a Linux system # -l option targets the local network arp-scan -l
Host and Port Scanning with Nmap: Nmap (Network Mapper) is the industry standard tool for network discovery. It can perform everything from a simple ping sweep to a full-fledged service and OS fingerprinting scan.
# Nmap command to perform a SYN scan (-sS), perform service version detection (-sV), # and OS detection (-O) on a target IP or range. nmap -sS -sV -O 192.168.1.0/24 # Example Output Interpretation: # HOST: 192.168.1.10 # PORTS: 22/open/ssh/OpenSSH 7.2p2 | 80/open/http/Apache httpd 2.4.6 # OS: Linux 3.10 - 4.11
Banner Grabbing (Service Enumeration): After finding an open HTTP port (80), a simple telnet connection can "grab the banner" and confirm the web server software and version without using a specialized scanner:
# Connect to the target on port 80 telnet 192.168.1.10 80 # After connecting, manually type the HTTP request and press Enter twice HEAD / HTTP/1.0 # The server's response header reveals the service information: # HTTP/1.1 200 OK # Server: Apache/2.4.6 (CentOS)