Nmap Tutorial Series 3: Advanced Nmap Commands

Time to tackle the third part of the Nmap Tutorial Series. After covering Nmap Basics and Nmap Host Discovery, we are going to look at some more advanced Nmap commands. Sometimes it is necessary to perform scans that will do something else than the TCP scan that Nmap is doing by default. Those more advanced commands are used to detect exotic services or to evade firewalls.

Note: If you want to use Nmap on Windows without the need of installing bare-metal Linux or a virtual machine utilizing the power of WSL 2, we have an entire tutorial series covering how to do that.

Table of Contents

๐Ÿ‘€ This Tutorial has some related Articles!
๐Ÿ‘‰ Part 1 โ€“ Nmap Basics
๐Ÿ‘‰ Part 2 โ€“ Nmap Host Discovery
๐Ÿ‘‰ Part 3 โ€“ Advanced Nmap Commands
๐Ÿ‘‰ Part 4 โ€“ Nmap NSE Scripts
๐Ÿ‘‰ Part 5 โ€“ Nmap on Windows

Advanced Nmap Commands Overview

First, letโ€™s have an overview of all the advanced Nmap commands.

CommandOption
-sSTCP SYN Scan
-sTTCP Connect Scan
-sUUDP Scan
-sNTCP NULL Scan
-sFTCP FIN Scan
-sXXmas Scan
-sATCP ACK Scan
-sOIP Protocol Scan
-sZSCTP COOKIE ECHO Scan
-slIdle Scan
Nmap Commands Overview

TCP SYN Scan (-sS)

sudo nmap -sS 192.168.56.101Code language: CSS (css)
Nmap TCP Syn Scan

This scan scans for the 1000 most used TCP ports by sending SYN packages to a target and awaiting a response. This Nmap command is more on the stealthy side of things because it doesnโ€™t try to connect to the target, you might be able to avoid being detected when using this command. I say might because it highly depends if the network has an IDS (Intrusion Detection System) in place or not.

TCP Connect Scan (-sT)

nmap -sT 192.168.56.101Code language: CSS (css)
Nmap TCP Connect Scan

The TCP Connect scan can be run without sudo, it attempts to establish a plain connection to the target host. This command is noisy, so use it with caution.

UDP Scan (-sU)

sudo nmap -sU 192.168.56.101Code language: CSS (css)
Nmap UDP Scan

The UDP Scan is a valuable asset for scanning services that use UDP like DNS and DHCP. I always run a UDP scan to find all the services that donโ€™t use TCP.

๐Ÿ‘€ This Tutorial has some related Articles!
๐Ÿ‘‰ How to get started in Cyber Security โ€“ The Complete Guide
๐Ÿ‘‰ How to get started with Bug Bounties
๐Ÿ‘‰ Terminal Customization Series
๐Ÿ‘‰ Best Ethical Hacking Books
๐Ÿ‘‰ Download Kali Linux Safe & Easy
๐Ÿ‘‰ Best Ethical Hacking Tools
๐Ÿ‘‰ Install VSCode on Kali Linux
๐Ÿ‘‰ Dual Boot Kali Linux with Windows
๐Ÿ‘‰ Install Kali Linux on VirtualBox โ€“ Complete Beginner Guide
๐Ÿ‘‰ Top Things to do after installing Kali Linux
๐Ÿ‘‰ WiFi Adapter for Kali Linux โ€“ The Ultimate Guide
๐Ÿ‘‰ Nmap Beginner Guide Series
๐Ÿ‘‰ Metasploit Tutorial Series
๐Ÿ‘‰ Burp Suite Beginner Guide

TCP NULL Scan (-sN)

sudo nmap -sN 192.168.56.101Code language: CSS (css)
Nmap TCP NULL Scan

The TCP NULL Scan sends packets without TCP flags. This method is used to get the firewall to respond to the scan.

TCP FIN Scan (-sF)

sudo nmap -sF 192.168.56.101Code language: CSS (css)
Nmap TCP FIN Scan

The TCP FIN Scan is used to get a TCP ACK response from the target. This is just another way to get around a firewall and trigger a response from the target host.

Xmas Scan (-sX)

sudo nmap -sX 192.168.56.101Code language: CSS (css)
Nmap Xmas Scan

This funny-sounding scan, a quote from Nmapโ€™s official documentation, โ€œSets the FIN, PSH and URG flags, lighting the packet up like a Christmas tree.โ€ describes this scan pretty well. This is used to provoke a response from a target host behind a firewall. Itโ€™s obvious that this is a noisy approach.

TCP ACK Scan (-sA)

sudo nmap -sA 192.168.56.101Code language: CSS (css)
Nmap TCP ACK Scan

The TCP ACK scan is used to check if a system is protected by a firewall or not. If no RST response is given from the target system, Nmap assumes that the target system is filtered. If the target system returns an RST response, it will be set as unfiltered. Ports being filtered is an indication that the system is behind a firewall. Unfiltered ports are most likely allowed through the firewall through specific rules.

IP protocol Scan (-sO)

sudo nmap -sO 192.168.56.101Code language: CSS (css)
Nmap IP Protocol Scan

The IP protocol scan shows all protocols that are supported by the target. This option is mostly used to determine what kind of scans you will run against the target system based on its protocols. You can find a list of all protocols here.

sudo nmap -sZ 192.168.56.101Code language: CSS (css)
nmap SCTP Cookie Echo Scan

This scan is a more advanced SCTP scan. Itโ€™s a pretty silent way of scanning because it drops packets containing Cookie Echo chunks on open ports, but it does send an Abort response if the port is closed. This scan is pretty silent, although it still can be detected by a well-configured IDS.

Idle Scan (-sI)

sudo nmap -sI 192.168.56.103(<--Zombie Host) 192.168.56.101Code language: CSS (css)
Nmap Idle Scan

This scanning method runs a completely blind TCP port scan against the target. There are no packets sent from your own IP address. This technique uses a so-called Zombie Host to gather information about the target. You basically specify a Zombie Host on the network that will send the packets for you, making it hard for IDS to detect your scanner.

I really like this method and use it quite often as it is really stealthy. Note that this scan does not work all the time, as you can see in my example.

Conclusion

This should give you a good of some Advanced Nmap Commands. How often you use those Nmap Commands in the real world highly depends on the scenario. Sometimes simple Nmap scans are enough to detect open ports on most systems.

๐Ÿ‘€ This Tutorial has some related Articles!
๐Ÿ‘‰ Part 1 โ€“ Nmap Basics
๐Ÿ‘‰ Part 2 โ€“ Nmap Host Discovery
๐Ÿ‘‰ Part 3 โ€“ Advanced Nmap Commands
๐Ÿ‘‰ Part 4 โ€“ Nmap NSE Scripts
๐Ÿ‘‰ Part 5 โ€“ Nmap on Windows

Leave a Comment

This site uses Akismet to reduce spam. Learn how your comment data is processed.

Share via
Copy link
Powered by Social Snap