This lab guides you through the essential steps of footprinting a web server and its associated infrastructure using common tools available in Kali Linux. Footprinting is a critical first step in the ethical hacking process, gathering information to understand the target's attack surface before conducting vulnerability assessment or exploitation.
- Perform Server Discovery to identify live hosts
- Conduct Service Discovery to find open ports and running services
- Identify web server software, version, and underlying OS
- Discover hidden content (directories and files) on web servers
- Utilize tools like Nmap, Curl, WhatWeb, Dirb, Gobuster, and Nikto
- Correlate findings for comprehensive security assessment
This lab must be performed ONLY on systems you have explicit permission to test. For practice, use dedicated vulnerable virtual machines like Metasploitable 2/3 or OWASP Juice Shop within a controlled virtual network environment. Unauthorized scanning is illegal and unethical.
Lab Setup & Environment Preparation
Environment Preparation
-
Install Required Tools: Ensure you have Kali Linux (or another Linux distribution with the necessary tools installed) running, preferably as a virtual machine. Ensure tools like Nmap, Curl, WhatWeb, Dirb, Gobuster, and Nikto are installed:
sudo apt update && sudo apt install nmap curl whatweb dirb gobuster nikto -y - Deploy Target Machine: Set up a target vulnerable machine (e.g., Metasploitable2) on the same virtual network as your Kali machine. Ensure network settings allow communication between the two VMs (e.g., Host-only or NAT Network in VirtualBox/VMware).
-
Find the Target IP Address: Log in to your target machine (e.g., Metasploitable2 credentials are often
msfadmin/msfadmin). Use the commandip addrorifconfigto find its IP address. Note this address down; we will refer to it as TARGET_IP throughout this lab.# Example command on target machine ip addr show eth0 | grep "inet " -
Find Your Kali IP Address (Optional but helpful): In your Kali terminal, run
ip addrto know your own IP and network range.
Phase 1: Server Discovery (Is the Target Alive?)
Before scanning services, confirm the target host is online and reachable using basic connectivity tests.
Step 1.1: Basic Ping Check
Use the ping command to send ICMP echo requests and verify basic network connectivity.
ping -c 4 TARGET_IPExpected Result: Look for replies (e.g., "64 bytes from ... ttl=...") indicating the host is responding. Note that some systems block ICMP, so a lack of response doesn't always mean the host is down.
Step 1.2: Nmap Host Discovery
Use Nmap's -sn (No Port Scan) flag for more reliable host discovery, which uses various probes (ARP, ICMP, TCP SYN/ACK to common ports).
sudo nmap -sn TARGET_IPAlternatively, scan the entire local network range (find your range first using ip addr):
sudo nmap -sn YOUR_NETWORK_RANGE/24Expected Result: Nmap will list hosts that are "up". Confirm your TARGET_IP appears in the list.
Phase 2: Service Discovery (What's Running?)
Identify open ports and the services listening on them, focusing on web-related ports (80, 443, 8080, etc.).
Step 2.1: Basic TCP Port Scan (Common Ports)
Perform a TCP SYN scan (-sS, usually requires sudo) or TCP Connect scan (-sT) on the most common ports.
sudo nmap -sS -F TARGET_IP(-F scans the 100 most common ports). Look for ports listed as open, especially 80 (HTTP) and 443 (HTTPS).
Step 2.2: Comprehensive Port Scan (All Ports)
Scan all 65535 TCP ports. This takes much longer but is more thorough for comprehensive assessment.
sudo nmap -sS -p- -T4 TARGET_IP(-p- means all ports, -T4 increases speed - use cautiously in production environments).
Expected Result: A list of all open TCP ports on the target. Identify web-related ports (80, 443, 8000, 8080, 8443, etc.). Note these down for the next steps.
Step 2.3: Service Version Detection
Identify the specific services and their versions running on the open ports found in previous steps.
sudo nmap -sV -p PORT_LIST TARGET_IPReplace PORT_LIST with the comma-separated list of open web-related ports found previously (e.g., -p 80,443,8080).
Expected Result: Nmap attempts to determine the service (e.g., http, https, http-proxy) and version (e.g., Apache httpd 2.2.8, Nginx 1.18.0) for each specified open port.
Phase 3: Server Identification (Web Server & OS)
Gather more details about the web server software and the underlying operating system using advanced fingerprinting techniques.
Step 3.1: Nmap OS Detection
Attempt to identify the operating system (requires open and closed ports for accuracy).
sudo nmap -O TARGET_IPExpected Result: Nmap provides its best guess for the OS (e.g., Linux 2.6.x). Accuracy varies based on available information and network conditions.
Step 3.2: Basic Banner Grabbing (Manual/Curl)
Retrieve HTTP headers, which often contain the Server banner revealing web server information.
curl -I http://TARGET_IP:PORT(Replace PORT with the open HTTP port, usually 80. Use https:// and port 443 for HTTPS, adding -k if the certificate is self-signed).
Expected Result: Look for the Server: header (e.g., Server: Apache/2.2.8 (Ubuntu)).
WhatWeb identifies websites and the technologies they use. It has over 900 plugins to recognize CMS, analytics packages, web servers, embedded devices, version numbers, and more. It's particularly effective for comprehensive web technology fingerprinting.
Step 3.3: Basic WhatWeb Scan
Run a default scan against the target web server to identify technologies and frameworks.
whatweb http://TARGET_IP:PORT(Adjust protocol http/https and PORT based on discovered open web ports).
Expected Result: A concise summary of detected technologies (e.g., Apache, JQuery, PHP, specific CMS platforms).
Step 3.4: Verbose and Aggressive WhatWeb Scan
Increase verbosity (-v) to see plugin details and use aggression level 3 (-a 3) to perform more requests for potentially better version detection.
whatweb -v -a 3 http://TARGET_IP:PORTExpected Result: More detailed output, including descriptions of detected plugins, specific version numbers if found (like Apache[2.2.22]), OS hints from server headers (HTTPServer[Ubuntu Linux]), detected libraries (JQuery), and potentially other framework details or interesting headers (X-UA-Compatible). Examine the "Summary", "Detected Plugins", and "HTTP Headers" sections carefully.
Phase 5: Analysis and Reporting
The real value in footprinting comes from correlating the findings from different phases and tools:
- Did Nmap identify Apache 2.2.8? Research known CVEs for that version.
- Did WhatWeb identify PHP 5.2.4 and JQuery? Look for vulnerabilities specific to those versions or related components.
- Did Dirb/Gobuster find an
/adminor/phpmyadmindirectory? Try accessing it in a browser. - Did Nikto report a specific configuration weakness? Investigate how it might be exploited.
- Combine OS information with service versions to build a comprehensive target profile.
Document your findings methodically in your report, noting the tool used, the command run, the key results, and potential security implications or next steps for vulnerability analysis.
Conclusion
You have successfully performed fundamental web infrastructure footprinting using common Kali Linux tools, following a methodology aligned with CEH objectives. You discovered the target server, identified running services, fingerprinted the web server software and OS, identified underlying technologies using WhatWeb, and searched for hidden content. These steps provide a foundational understanding of the target's web presence, crucial for subsequent vulnerability analysis and penetration testing phases.
This lab guide is for educational purposes within authorized environments only. Unauthorized scanning or testing of systems is illegal and unethical. Always obtain explicit permission before conducting any security assessments and comply with all applicable laws and regulations. The techniques shown here should only be used in environments you own or have written authorization to test.