From Discovery to Enumeration

The Strategic Pentester's Cheatsheet: From Discovery to Enumeration

This cheatsheet provides a strategic, multi-phase workflow for network enumeration during a penetration test. The methodology progresses from broad, quiet discovery to in-depth analysis, now incorporating multiple tool options for each task.

Phase 1: Host Discovery (Finding Live Targets)

Strategy: The goal is to identify live hosts without triggering alerts. Start with methods that are less likely to be logged, like ARP on a local network, before moving to ICMP or TCP/UDP-based discovery.

  • LAN Discovery (Fast & Reliable):

    • Use Case: You are on the local network. This is the most effective method.

    • Tools:

      # Nmap (Recommended)
      # -PR: ARP Scan | -sn: "Ping Scan" (disables port scan)
      sudo nmap -sn -PR 192.168.1.0/24 -oA discovery_arp
      
      # arp-scan (Very Fast)
      sudo arp-scan -l
      
  • Standard Network Discovery:

    • Use Case: Scanning external networks or internal subnets where ARP is not possible.

    • Tools:

      # Nmap (Recommended for flexibility)
      # -PS: TCP SYN to common ports | -PA: TCP ACK | -PU: UDP
      # This combination bypasses many simple firewall rules that block only ICMP.
      sudo nmap -sn -PS80,443 -PA22 -PU53 10.10.10.0/24 -oA discovery_standard
      
      # fping (Fast ICMP sweep)
      fping -a -g 10.10.10.0/24 2>/dev/null
      
  • Assume All Hosts Are Up (When Blocked):

    • Use Case: A restrictive firewall is dropping your discovery probes. This is slow but necessary.

    • Method:

      # -Pn: Skips host discovery entirely and attempts to port scan every IP.
      # This is an Nmap flag, not a standalone tool.
      # Combine this with the scanning techniques in Phase 2.
      

Phase 2: Port Scanning (Mapping the Attack Surface)

Strategy: Employ a multi-step approach. Use ultra-fast scanners like masscan to find open ports, then feed those results into nmap for deep analysis. This is far more efficient than running a full nmap scan from the start.

  • Step 1: Fast Initial Port Scan:

    • Purpose: Quickly identify open ports across large IP ranges.

    • Tools:

  • Step 2: Detailed Service & Script Scan (On Discovered Ports):

    • Purpose: This is the main enumeration scan. It runs version detection, default scripts, and OS detection on the specific ports you found open.

    • Tool:

  • Step 3: UDP Scan (As Needed):

    • Purpose: UDP is slow to scan. Only run this if you suspect key UDP services are in use (e.g., DNS, SNMP, Kerberos).

    • Tool:

Phase 3: Service-Specific Enumeration (Deep Dive)

Strategy: Now that you have a list of open ports and versions, attack each service with specialized tools and scripts. Always check for anonymous/guest access and known misconfigurations first.

Authentication & Directory Services

  • LDAP (389, 636):

    • Tools: nmap, ldapsearch

  • Kerberos (88):

    • Tools: nmap, kerbrute, impacket-GetNPUsers

  • SMB (139, 445):

    • Tools: crackmapexec, enum4linux-ng, smbclient, smbmap

Remote Access & Management

  • SSH (22):

    • Tools: nmap, ssh-audit

  • RDP (3389):

    • Tools: nmap, xfreerdp

  • WinRM (5985, 5986):

    • Tools: nmap, evil-winrm

  • VNC (5900):

    • Tools: nmap

File Transfer & Sharing

  • FTP (21):

    • Tools: nmap, ftp (client)

  • NFS (2049):

    • Tools: nmap, showmount

  • RSync (873):

    • Tools: nmap, rsync

Web & Application Services (Expanded)

Strategy: Web enumeration is a deep discipline. Start with fingerprinting to understand the technology stack. Then, aggressively search for hidden content. Finally, scan for common vulnerabilities based on your findings.

  • Step 1: Initial Recon & Fingerprinting:

    • Purpose: Identify web server software, frameworks, and technologies. Manually inspect headers and source code.

    • Tools:

  • Step 2: Content Discovery (Directory & Subdomain Fuzzing):

    • Purpose: Find hidden pages, directories, API endpoints, and virtual hosts.

    • Tools:

  • Step 3: CMS & Framework Specific Scanning:

    • Purpose: Use specialized tools if a specific CMS like WordPress is identified.

    • Tools:

  • Step 4: Automated Vulnerability Scanning:

    • Purpose: Scan for common vulnerabilities like SQLi, XSS, and misconfigurations.

    • Tools:

  • Step 5: Manual Interaction & Data Transfer:

    • Purpose: Download files for offline analysis or interact with the server manually.

    • Tools:

Databases

  • MySQL (3306), MSSQL (1433), PostgreSQL (5432):

    • Tools: nmap, native clients (mysql, sqlcmd, psql)

  • Redis (6379) & Elasticsearch (9200):

    • Tools: nmap

Core Network Services

  • DNS (53):

    • Tools: nmap, dig, dnsrecon

  • SNMP (UDP 161):

    • Tools: nmap, snmpwalk, snmp-check

  • SMTP (25, 465, 587):

    • Tools: nmap, netcat

Phase 4: Strategic Scans & Workflows

Strategy: Combine the phases into repeatable workflows for different scenarios.

  • External Pentest Workflow (Stealthy -> Detailed):

    1. nmap -sn -PS80,443 -PA22 <target_range> -oA external_hosts

    2. masscan -p1-65535 --rate=5000 -iL external_hosts.nmap -oG masscan.grep

    3. Extract IPs and ports from masscan.grep.

    4. nmap -sV -sC -O -p<PORTS> -iL <targets_with_open_ports> -oA external_detailed

    5. Begin deep enumeration from Phase 3 on discovered services.

  • Internal Pentest Workflow (Fast & Comprehensive):

    1. nmap -sn -PR <target_range> -oA internal_hosts

    2. nmap -sS --top-ports 1000 -T4 --min-rate 1000 -iL internal_hosts.nmap -oA internal_fast_scan

    3. nmap -sV -sC -O --script="smb-enum-*,smb-vuln*,vuln" -iL internal_hosts.nmap -oA internal_full_enum

    4. Use tools like crackmapexec and enum4linux-ng on discovered Windows hosts.

Last updated