Understanding Network Scanning Fundamentals
Network scanning is the systematic process of sending probes to network hosts. The primary goal is to discover live hosts and determine which ports are open, closed, or filtered.
How Scanning Works
Scanning typically begins with ping sweeps to identify active hosts. It then progresses to port scanning to determine running services. The three main port scan types are:
- TCP connect scans: Complete the full three-way handshake and are easily logged
- SYN stealth scans: Send a SYN packet and listen for responses without completing the handshake
- UDP scans: Probe connectionless services
Nmap Scan Types and Flags
Nmap, the industry-standard scanning tool, uses various scan types designated by flags. Common flags include:
- -sS for SYN scans
- -sT for TCP connect scans
- -sU for UDP scans
- -A for aggressive scans with OS detection
Understanding the OSI model is essential because different scanning techniques operate at different layers. TCP scanning operates at Layer 4, while ICMP ping sweeps work at Layer 3.
Avoiding Detection
Firewalls and intrusion detection systems (IDS) monitor for suspicious scanning patterns. Ethical hackers must understand evasion techniques like fragmentation, decoys, and idle scanning.
Timing templates in Nmap range from paranoid (slowest) to insane (fastest). This allows security professionals to balance detection avoidance with scan speed. Proper documentation of scanning results creates evidence chains and demonstrates due diligence in authorized penetration testing engagements.
Enumeration Techniques and Information Extraction
Enumeration is the active probing of discovered services to extract detailed information about system configurations, user accounts, and network shares. Unlike scanning, enumeration directly interacts with services and may trigger security alerts.
Common Enumeration Protocols
Each protocol reveals specific information about systems:
- NetBIOS enumeration: Extract computer names, workgroup information, and logged-in users from Windows systems using nbtstat and nbtscan
- SNMP enumeration: Query managed devices using community strings (public and private) to extract system information and running processes
- SMTP enumeration: Connect to mail servers and use VRFY and EXPN commands to validate email addresses
- DNS enumeration: Perform zone transfers, reverse DNS lookups, and query MX records for mail server information
- LDAP enumeration: Target directory services to extract user accounts, organizational structure, and group memberships
Each protocol has default ports that should be memorized. SNMP uses port 161, SMTP uses port 25, and LDAP uses port 389.
Enumeration Tools and Results
enum4linux automates Windows enumeration across multiple protocols. Nmap scripts (NSE) perform service-specific enumeration. Enumeration results provide the foundation for targeted exploitation because they reveal specific service versions, user accounts, and system configurations that may contain known vulnerabilities.
Legal and ethical considerations are paramount. Enumeration must only occur on authorized systems with documented scope and permission.
Common Scanning Tools and Their Applications
Choosing the right tool depends on your scanning objectives and network environment. Each tool serves specific purposes and offers different capabilities.
General-Purpose Scanning Tools
Nmap remains the quintessential network scanning tool, offering flexibility through command-line options for virtually any scanning scenario. A basic command like nmap -sS -p- -A target-ip performs comprehensive SYN scans of all ports with service detection and OS fingerprinting.
Zenmap provides a graphical interface for Nmap with pre-built profiles for common scan types like intense scanning, ping scan, and quick scan. Masscan is designed for large-scale network scanning of entire IP ranges, capable of scanning the entire internet in under six minutes.
Advanced Packet Manipulation
Hping3 offers advanced packet crafting capabilities for creating custom TCP, UDP, and ICMP packets. It is useful for firewall testing and traceroute functionality.
Angry IP Scanner provides a user-friendly interface for rapid host discovery. SuperScan offers Windows-based scanning with ping, traceroute, and whois functionality.
Windows and DNS Enumeration
For Windows-specific enumeration, use these tools:
- enum4linux
- wmic (Windows Management Instrumentation Command)
- Get-NetTCPConnection (PowerShell)
DIG and NSLOOKUP are essential command-line tools for DNS enumeration and querying DNS servers. The Metasploit framework integrates scanning and enumeration modules within a unified platform, allowing automated scanning workflows.
Understanding tool capabilities, output formats, and appropriate use cases is critical for CEH exam success and practical penetration testing work.
Port Numbers, Protocols, and Service Recognition
Memorizing common ports and their associated services is essential for effective scanning and enumeration. This knowledge directly impacts your exam performance and real-world penetration testing success.
Critical Ports to Memorize
Focus on these high-value ports and their services:
- Port 21: FTP (vulnerable to credential harvesting)
- Port 22: SSH (encrypted but older versions have known vulnerabilities)
- Port 23: Telnet (legacy, unencrypted)
- Port 25: SMTP (enables VRFY enumeration)
- Port 53: DNS (allows zone transfers if misconfigured)
- Port 80: HTTP (requires web application testing)
- Port 110: POP3 (mail protocol)
- Port 143: IMAP (mail protocol)
- Port 389: LDAP (directory services)
- Port 443: HTTPS (encrypted web traffic)
- Port 445: SMB (Windows network shares)
- Port 3306: MySQL (database service)
- Port 3389: RDP (remote desktop)
- Port 5432: PostgreSQL (database service)
Service Detection and Fingerprinting
Nmap's service detection feature (-sV) probes open ports to identify running services and versions. It analyzes responses against its database of service signatures. Banner grabbing involves connecting to services and reading the server response to identify application names and versions.
The combination of port number, protocol, and service version creates a unique fingerprint used to identify exploitable vulnerabilities. Database ports like MySQL and PostgreSQL may allow remote connections vulnerable to brute-force attacks if improperly secured.
Port Range Classifications
CEH candidates must memorize these port range categories:
- Well-known ports (0-1023)
- Registered ports (1024-49151)
- Dynamic ports (49152-65535)
Understanding these relationships allows candidates to quickly recognize common configurations and potential security oversights. Flashcards effectively reinforce these associations through repeated exposure and active recall.
Legal, Ethical, and Practical Considerations in Scanning and Enumeration
Scanning and enumeration without explicit authorization is illegal under computer fraud and cybercrime laws. The Computer Fraud and Abuse Act (CFAA) in the United States and similar legislation internationally explicitly prohibit unauthorized network scanning.
Authorization and Scope
Authorized penetration testing requires documented scope defining exactly which IP ranges, systems, and services may be tested. Scope also specifies time windows for testing and requires approval from system owners. Rules of engagement establish protocols for handling sensitive data discovered during testing and define escalation procedures if critical vulnerabilities are found.
Test data and results must be carefully protected as they contain detailed information about system configurations and potential vulnerabilities.
Conducting Ethical Tests
Ethical hackers must avoid causing denial-of-service conditions through aggressive scanning. Particularly on production systems, resource consumption could impact business operations. Some organizations implement network segmentation to prevent unauthorized scanning, and attempting to bypass such controls may violate engagement scope.
Stealth techniques like timing adjustments, fragmentation, and decoys may be appropriate in authorized red team exercises. Outside authorized testing, they indicate hostile intent. Documentation throughout the scanning and enumeration process creates an audit trail demonstrating thorough, professional work.
Professional Standards and Consequences
Results should be reported professionally with technical details but without actionable exploitation steps. The CEH Code of Conduct requires that certified professionals maintain high ethical standards, respect privacy, and follow laws and regulations.
Understanding these legal and ethical boundaries is as important as technical competence. Improper execution can result in legal liability, loss of professional credentials, and harm to employers. Flashcards should reinforce not only technical concepts but also the ethical principles governing penetration testing.
