Introduction
Scanning and enumeration are fundamental techniques for network reconnaissance. Scanning involves probing a network to discover active hosts, open ports, and services running on those ports. Enumeration dives deeper into identifying specific details like operating systems and service versions.
Tool Overview: Nmap
Nmap, short for "Network Mapper," is a versatile tool used for network exploration and security auditing. Originally designed for large-scale network mapping, it has evolved to include extensive functionality beyond its initial scope.
Phases of an Nmap Scan
In this lab, you'll focus on four key phases of an Nmap scan:
- Host Discovery (Ping scanning): Identifying active hosts on the network.
- Port Scanning: Identifying open ports on discovered hosts.
- Operating System Detection: Determining the operating systems of the identified hosts.
- Service/Service Version Detection: Identifying the services and their versions running on open ports.
Understanding Ports
Before diving into Nmap, it's crucial to understand ports. Ports are analogous to apartment unit numbers in a building (IP address). They identify specific services or applications running on a host. TCP ports are particularly common on the Internet and require a 3-way handshake for connection establishment.
Getting Started with Nmap
Executing Your First Scan:
- Open a Terminal window in the lab environment.
- Type nmap 192.168.0.1 to perform a TCP connect scan (default without root privileges).
- This scan completes the full 3-way handshake to establish connections with open ports.
Advanced Scan with Root Privileges:
- Type sudo nmap 192.168.0.1 to perform a SYN stealth scan (half-open scan).
- This scan initiates but does not complete the TCP handshake, providing faster results.
Understanding Scan Results:
- Open ports are categorized into three states: Open, Closed, and Filtered.
- Open ports have active services, closed ports have no active services, and filtered ports are protected by a firewall.
Nmap Options Overview:
- -Pn: Disables host discovery and treats all hosts as online.
- -sS: SYN stealth scan, faster but more likely to be detected by modern firewalls.
- -O: Detects the operating system of the target host.
- -sV: Detects services and their versions running on open ports.
- -T1-5: Adjusts scan speed with timing templates from Paranoid (slowest) to Insane (fastest).
Lab Questions and Answers: 1.1 Core Concepts
True or False: Scanning refers to the use of various tools and techniques to survey a network for active hosts, open ports, and the types of services running on those ports.
A. True
B. False
Answer: A
True or False: Enumeration refers to passively gathering detailed information using publicly available resources.
A. True
B. False
Answer: B
Which of the following is not an application of Nmap?
A. Inventorying hosts on a network.
B. Extracting files from network traffic.
C. Mapping attack surface area.
D. Detecting firewalls and vulnerable hosts.
Answer: B
What Nmap option allows you to enumerate service and service versions on a host?
Answer: -sV