Listen to this Post

Introduction:
Network reconnaissance is the cornerstone of every cybersecurity engagement, and Nmap remains the undisputed industry standard for port scanning, host discovery, and vulnerability assessment【1†L1-L4】. Understanding the nuanced differences between SYN scans, FIN scans, Xmas scans, and ACK scans is not merely an academic exercise—it is a critical skill that separates effective penetration testers from script kiddies. This article breaks down every major Nmap scan type with practical command examples, real-world use cases, and platform-specific instructions to elevate your network security game.
Learning Objectives:
- Master the syntax and use cases for all major Nmap scan types including -sS, -sT, -sF, -sN, -sX, -sP, -sA, and -sW
- Learn how to combine scan flags with timing options, port specifications, and output formats for maximum efficiency
- Understand how to interpret scan results to identify firewall rules, operating systems, and potential attack vectors
- Apply Nmap scanning techniques in both Linux and Windows environments with verified command examples
1. TCP SYN Scan (-sS): The Stealthy Default
The TCP SYN scan, often called “half-open” scanning, is the default scan type for privileged users and the most widely used technique in professional assessments【1†L7】. It works by sending a SYN packet and, upon receiving a SYN-ACK response, replying with a RST packet instead of completing the three-way handshake. This approach never establishes a full connection, making it less likely to be logged by applications and providing a stealthier footprint.
Step-by-Step Guide:
Linux (requires root privileges):
sudo nmap -sS -p 1-1000 192.168.1.1
Windows (run as Administrator):
nmap -sS -p 1-1000 192.168.1.1
What this does: The -sS flag initiates a SYN scan against ports 1 through 1000 on the target. Root or Administrator privileges are required because Nmap needs to craft raw packets. This scan is fast, relatively stealthy, and provides reliable state information about open, closed, and filtered ports.
Pro Tip: Combine with -T4 for faster execution: `sudo nmap -sS -T4 -p- 192.168.1.1`
2. TCP Connect Scan (-sT): The Non-Privileged Alternative
When you lack root/Administrator privileges, Nmap falls back to the TCP connect scan【1†L8】. Unlike the SYN scan, this method uses the operating system’s connect() system call to complete the full three-way handshake with every target port. While more accurate in some environments, it is slower and generates more logs since connections are fully established and torn down.
Step-by-Step Guide:
Linux (no root required):
nmap -sT -p 22,80,443 192.168.1.1
Windows (no Admin required):
nmap -sT -p 22,80,443 192.168.1.1
What this does: The -sT flag performs a full TCP connection attempt to ports 22 (SSH), 80 (HTTP), and 443 (HTTPS). This scan is useful when you are operating from a restricted user account or when the target network drops SYN packets but allows full connections.
Pro Tip: Use -sT when scanning localhost or when ICMP unreachable responses interfere with SYN scans.
- FIN, NULL, and Xmas Scans (-sF, -sN, -sX): The Stealth Trio
These three scan types exploit subtle differences in how TCP stacks handle unusual packet flag combinations【1†L9-L11】. The FIN scan sends packets with only the FIN flag set, the NULL scan sends packets with no flags set, and the Xmas scan illuminates the packet with FIN, PSH, and URG flags simultaneously【1†L11】. According to RFC 793, closed ports should respond with a RST packet to any incoming packet that does not have SYN, ACK, or RST flags set. Open ports, however, typically ignore such packets, providing a clever way to determine port states without initiating a connection.
Step-by-Step Guide:
Linux (requires root):
FIN scan sudo nmap -sF -p 1-100 192.168.1.1 NULL scan sudo nmap -sN -p 1-100 192.168.1.1 Xmas scan sudo nmap -sX -p 1-100 192.168.1.1
Windows (requires Admin):
nmap -sF -p 1-100 192.168.1.1 nmap -sN -p 1-100 192.168.1.1 nmap -sX -p 1-100 192.168.1.1
What this does: These scans are designed to evade basic firewall and intrusion detection systems that only log SYN packets. They are particularly effective against non-Windows systems, as Microsoft’s TCP stack responds with RST to all unsolicited FIN/ACK probes, rendering these scans ineffective against Windows targets.
Pro Tip: Combine these with decoy scans (-D) for enhanced stealth: `sudo nmap -sX -D RND:10 -p 80 192.168.1.1`
- Ping Scan (-sP / -sn): The Discovery Workhorse
The ping scan, also known as host discovery, is the first step in any large-scale network assessment【1†L12】. It determines which hosts are online before launching more intensive port scans, saving time and reducing network noise. Modern Nmap uses the -sn flag (replacing the older -sP) to perform ICMP echo requests, TCP SYN to port 443, TCP ACK to port 80, and ICMP timestamp requests by default.
Step-by-Step Guide:
Linux:
Basic ping sweep nmap -sn 192.168.1.0/24 Custom ping sweep with specific ports sudo nmap -sn -PS22,80,443 192.168.1.0/24
Windows:
nmap -sn 192.168.1.0/24
What this does: The -sn flag sends a series of probes to each IP in the specified subnet and reports which hosts respond. This is invaluable for mapping network inventory, identifying rogue devices, and planning subsequent targeted scans.
Pro Tip: Use `-PE` (ICMP echo), `-PP` (ICMP timestamp), and `-PM` (ICMP netmask) to customize probe types for environments where default probes are blocked.
- ACK Scan (-sA) and Window Scan (-sW): Firewall Mapping Techniques
The ACK scan is specifically designed to probe firewall rule sets rather than determine open ports【1†L13】. By sending ACK packets, you can distinguish between stateful and stateless firewalls. A RST response indicates the packet was allowed through (port is not filtered), while no response or an ICMP unreachable suggests filtering. The Window scan (-sW) exploits the TCP window size field in RST packets returned by some systems to infer port states【1†L14】.
Step-by-Step Guide:
Linux (requires root):
ACK scan to detect firewall filtering sudo nmap -sA -p 1-1000 192.168.1.1 Window scan to check TCP window behavior sudo nmap -sW -p 1-1000 192.168.1.1
Windows (requires Admin):
nmap -sA -p 1-1000 192.168.1.1 nmap -sW -p 1-1000 192.168.1.1
What this does: The -sA flag sends ACK packets to determine if ports are filtered. The -sW flag analyzes window size values in RST responses—non-zero window sizes often indicate open ports on some systems. These scans are essential for firewall rule discovery and validation during security audits【1†L4】.
Pro Tip: Pair ACK scans with `–traceroute` to map network path filtering: `sudo nmap -sA –traceroute 192.168.1.1`
6. Advanced Nmap Techniques: Timing, Output, and Scripting
Beyond basic scan types, Nmap’s true power lies in its timing options, output formats, and the Nmap Scripting Engine (NSE). These features transform a simple port scanner into a comprehensive vulnerability assessment platform.
Step-by-Step Guide:
Timing Templates (-T0 to -T5):
Paranoid slow (IDS evasion) sudo nmap -T0 -sS 192.168.1.1 Aggressive fast (internal networks) sudo nmap -T5 -sS -p- 192.168.1.1
Output Formats:
Normal output nmap -sS -oN scan_results.txt 192.168.1.1 XML output (for tools) nmap -sS -oX scan_results.xml 192.168.1.1 Grepable output (for scripts) nmap -sS -oG scan_results.gnmap 192.168.1.1
NSE Scripts (vulnerability detection):
Default safe scripts nmap -sS -sC 192.168.1.1 Vulnerability scanning nmap -sS --script vuln 192.168.1.1 Specific script nmap -sS --script http-headers 192.168.1.1
What this does: Timing templates control scan speed and stealth—lower numbers are slower and less detectable. Output formats enable integration with other security tools. NSE scripts extend Nmap’s capabilities to include banner grabbing, brute-force attacks, and vulnerability exploitation.
Pro Tip: Use `-sV` for version detection and `-O` for OS fingerprinting: `sudo nmap -sS -sV -O 192.168.1.1`
7. Platform-Specific Commands and Troubleshooting
Linux Commands:
Install Nmap sudo apt-get install nmap Debian/Ubuntu sudo yum install nmap RHEL/CentOS Full scan with all options sudo nmap -sS -sV -O -A -T4 -p- 192.168.1.1 Scan with source port spoofing sudo nmap -sS -g 53 192.168.1.1 Fragment packets for IDS evasion sudo nmap -sS -f 192.168.1.1
Windows Commands (PowerShell):
Basic scan nmap -sS -p 1-1000 192.168.1.1 Scan with random delays nmap -sS --scan-delay 1s 192.168.1.1 Output to file nmap -sS -oA scan_output 192.168.1.1
Troubleshooting Common Issues:
- Permission denied: Run with sudo (Linux) or Administrator (Windows)
- No response: Check firewall rules and network connectivity
- Slow scans: Increase timing template (-T4 or -T5) or reduce port range
- Inaccurate results: Try different scan types or use -sV for version confirmation
What Undercode Say:
- Key Takeaway 1: Mastering Nmap scan types is non-1egotiable for any cybersecurity professional—SYN scans for stealth, FIN/NULL/Xmas for evasion, and ACK scans for firewall mapping form the foundation of network assessment【1†L4-L14】.
- Key Takeaway 2: Always combine multiple scan techniques for comprehensive results; no single scan type provides a complete picture. Use -sS for speed, -sA for firewall analysis, and NSE scripts for vulnerability discovery.
Analysis: The landscape of network security is evolving rapidly, with zero-trust architectures and encrypted traffic making traditional scanning more challenging. Nmap’s adaptability—from basic port discovery to sophisticated script-based exploitation—ensures its continued relevance. However, practitioners must recognize that modern intrusion detection systems (IDS) and next-generation firewalls (NGFW) can easily detect and block SYN scans. The future belongs to those who combine Nmap with advanced evasion techniques, including packet fragmentation, decoy scans, and timing randomization. Moreover, integrating Nmap with automation frameworks like Ansible and security orchestration platforms will be essential for scaling assessments across large enterprise networks. The ethical imperative remains paramount: unauthorized scanning is illegal and unethical. Always obtain explicit written permission before conducting any network reconnaissance【1†L16】.
Prediction:
- +1: The integration of AI-powered Nmap script execution will automate vulnerability prioritization, reducing mean time to remediation (MTTR) by up to 40% by 2027.
- +1: Cloud-1ative scanning solutions will emerge, allowing security teams to deploy Nmap-based assessments as serverless functions for continuous compliance monitoring.
- -1: Increased adoption of encrypted SNI and TLS 1.3 will render traditional service version detection (-sV) less reliable, forcing the development of new fingerprinting techniques.
- -1: Zero-trust network access (ZTNA) solutions will make internal network scanning obsolete for many organizations, shifting focus to API and application-layer security assessments.
- +1: The Nmap community will release enhanced evasion modules specifically designed to bypass AI-driven IDS, ensuring the tool remains viable for authorized penetration testing.
- -1: Regulatory frameworks like GDPR and NIS2 will impose stricter penalties for accidental scanning of unauthorized systems, increasing the burden on security teams to maintain precise scope documentation.
▶️ Related Video (82% Match):
🎯Let’s Practice For Free:
🎓 Live Courses & Certifications:
Join Undercode Academy for Verified Certifications
🚀 Request a Custom Project:
Secure, high-velocity infrastructure and disruptive technological engineering. Contact our engineering team for high-tier development and proprietary systems:
[email protected]
💎 Smart Architecture | 🛡️ Secure by Design | ⭐ Trusted by Thousands
IT/Security Reporter URL:
Reported By: Cybersecurity Nmap – Hackers Feeds
Extra Hub: Undercode MoN
Basic Verification: Pass ✅


