Types of Nmap scans and best practices | TechTarget (2024)

Tip

Nmap scanning helps network teams with network reconnaissance and vulnerability discovery. Common types of scans include TCP SYN, OS detection, vulnerability and version detection.

All network infrastructures are at risk, due to sophisticated hackers and cyber threats. Bad actors can discover and exploit vulnerabilities, ruining a company's reputation and causing a loss of ROI. Thwarting attacks takes time, strategy and skilled teams.

Network engineers have many tools at their disposal to combat network threats. One such tool is Nmap, or Network Mapper. Nmap is a free, open source and cross-platform tool used for network discovery and audits. The tool supports scanning options and automated scripts to perform network reconnaissance and discover vulnerabilities.

Nmap provides the following three primary functionalities:

  1. Host discovery. Shows detailed information about every active network and each IP address.
  2. OS detection. Displays a list of active hosts and identifies the OS of every connected device.
  3. Port scanning. Helps identify security vulnerabilities.

By discovering devices, detecting OSes and scanning ports, Nmap identifies potential points of entry for cyber attacks. This information is useful for audits, making Nmap a versatile a tool for network administrators, pen testers, ethical hackers and even malicious hackers.

One of the most powerful features of Nmap is Nmap Scripting Engine (NSE). NSE enables users to write scripts to automate various network tasks. Nmap uses Lua, an embedded programming language, for writing scripts.

Nmap scanning techniques

Lockheed Martin, a well-known defense company, developed the Cyber Kill Chain model to trace the stages of a cyber attack. The first stage is reconnaissance. Network teams conduct network reconnaissance when performing network scans, and bad actors use it to gather information about attack targets. Nmap is a common tool used during the reconnaissance stage.

Types of Nmap scans and best practices | TechTarget (2)

Conducting a scan helps determine what is running on a computer or network, such as opened ports, services and applications. Nmap establishes a TCP connection using Internet Control Message Protocol, TCP or User Datagram Protocol messages to gather information during the scan.

Nmap offers various scanning techniques. Here are four of the most common types of scans. For more advanced scans, network admins can use the Lua programming language within Nmap to write scripts.

1. TCP SYN scan

A TCP SYN scan is a stealth scan used to determine if ports on a target system are open, closed or filtered. Nmap sends a SYN packet to the target and waits for a response. If the target responds with a SYN/ACK packet, the port is considered open and ready to establish a connection. These connection attempts might not appear in logs, depending on network configurations. If the target responds with an RST packet, the port is closed.

Here is the command to perform a TCP SYN scan:

sudo nmap -sS <<Target_computer_ip_address>>

After the scan, the screen displays information about the port, state and services, as seen in Figure 2.

Types of Nmap scans and best practices | TechTarget (3)

2. Version detection scan

A version detection scan gathers details about the services and applications running on identified open ports. The scan sends probes to open ports and receives responses from the services on those ports, garnering information about the type of services running.

Here is the command to run a version detection scan:

sudo nmap -sV <<Target_computer_ip address>>

In Figure 3, the version detection scan displays a version of Amazon CloudFront with Apache HTTP Server, a web service that speeds up the distribution of static and dynamic content, running on open ports.

Types of Nmap scans and best practices | TechTarget (4)

3. OS detection scan

An OS detection scan discovers which OS a target network or computer is running. Nmap sends TCP packets with specific characteristics, probes to the target host and determines the OS based on the host's responses. Advanced options of the scan can also detect the specific OS version and potential security risks. This information is useful during network reconnaissance.

Here is the command to run an OS detection scan:

sudo nmap -O <<Target_computer_ip_address>>

In Figure 4, the scan discovered a Microsoft OS.

Types of Nmap scans and best practices | TechTarget (5)

4. Vulnerability scan

A vulnerability scan detects Common Vulnerabilities and Exposures (CVEs) to discover if a target is vulnerable to attacks. Use -Pn to skip a ping scan, and add --script vuln to run vulnerability detection scripts against the target host.

Here is the command to run a vulnerability scan:

nmap -Pn --script vuln <<Target_computer_ip_address>>

The scan shows the Samba heap overflow vulnerability, CVE-2012-1182, on a Windows 10 system. This information is helpful for network admins to know what is happening on a network or target computer and avoid data leaks with vulnerable systems.

Types of Nmap scans and best practices | TechTarget (6)

Best practices for network vulnerability discovery

Some companies might prohibit network scanning unless they have an agreement or defined scope with the team performing the scans. Additionally, each country has its own laws and security frameworks. Network admins should always ensure they have proper authorization before running Nmap scans on a network, as unauthorized scanning can lead to legal consequences.

Here are some best practices for successful network vulnerability discovery:

  • Choose the right tool. The first step before conducting a scan is to choose a tool that suits your needs. Nmap is commonly used due to its scan accuracy.
  • Plan the scan. Always communicate with stakeholders before conducting a scan. It's possible to receive unexpected results without clear goals, scope and duration.
  • Run the scan. After planning, choose the type of scan, the targeted IP address, the IP address range -- if it's for the entire network -- and vulnerabilities to detect.
  • Scan frequently. Always refer to company policy to plan how often -- and what -- to scan. Is the scan weekly or monthly?
  • Analyze the vulnerabilities. Always review the scan and assess which CVEs pose the most risk of data leaks based on their severity.
  • Document the scan. After the scan, it's paramount to document. Each scan contains similarities, and documentation helps teams understand previous and future scans.

Nmap is a well-known tool for detecting network vulnerabilities. Network teams can take advantage of the tool by defining a scope for accurate scans, talking with different stakeholders and measuring results for safer networks.

Next Steps

Use Angry IP Scanner to audit the network

Dig Deeper on Network management and monitoring

  • network scanningBy: PaulKirvan
  • network vulnerability scanningBy: KinzaYasar
  • How to defend against TCP port 445 and other SMB exploitsBy: DianaKelley
  • Top Kali Linux tools and how to use themBy: PeterLoshin
Types of Nmap scans and best practices | TechTarget (2024)

FAQs

Types of Nmap scans and best practices | TechTarget? ›

the section called “TCP FIN, NULL, and Xmas Scans ( -sF , -sN , -sX )” noted that RFC-compliant systems allow one to scan ports using any combination of the FIN, PSH, and URG flags. While there are eight possible permutations, Nmap only offers three canned modes (NULL, FIN, and Xmas).

How many types of Nmap scans are there? ›

the section called “TCP FIN, NULL, and Xmas Scans ( -sF , -sN , -sX )” noted that RFC-compliant systems allow one to scan ports using any combination of the FIN, PSH, and URG flags. While there are eight possible permutations, Nmap only offers three canned modes (NULL, FIN, and Xmas).

What are the 5 different output formats available in Nmap? ›

Output formats and Nmap Scripting Engine
  • Normal output ( -oN )
  • XML output ( -oX )
  • Grepable output ( -oG )
  • Script kiddie ( -oS )

Which type of Nmap scan sends the most information at a target? ›

Expert-Verified Answer. Final answer: The type of nmap scan that sends the most information at a target is the Intense scan.

What is Nmap and its types? ›

Nmap scanning helps network teams with network reconnaissance and vulnerability discovery. Common types of scans include TCP SYN, OS detection, vulnerability and version detection.

Are Nmap scans illegal? ›

Unauthorized port scanning, for any reason, is strictly prohibited.

What are the different categories of Nmap scripts? ›

Script Categories. NSE scripts define a list of categories they belong to. Currently defined categories are auth , broadcast , brute , default . discovery , dos , exploit , external , fuzzer , intrusive , malware , safe , version , and vuln .

What is the default scan type in Nmap? ›

By default, Nmap performs a SYN Scan, though it substitutes a connect scan if the user does not have proper privileges to send raw packets (requires root access on Unix).

What type of packets are sent by Nmap? ›

If no host discovery options are given, Nmap sends an ICMP echo request, a TCP SYN packet to port 443, a TCP ACK packet to port 80, and an ICMP timestamp request.

Why do hackers use Nmap? ›

However, hackers can also use Nmap to access uncontrolled ports on a system. They can run Nmap on a targeted approach, identify vulnerabilities, and exploit them. But Nmap is not only used by hackers - IT security companies also use it to simulate potential attacks that a system may face.

Can Nmap detect TLS? ›

Nmap includes a script known as ssl-enum-ciphers , which can identify the cipher suites supported by the server, and it also rates them based on cryptographic strength. It makes multiple connections using SSLv3, TLS 1.1, and TLS 1.2.

Is Nmap still relevant? ›

With its wide range of applications, Nmap has become an essential tool for troubleshooting, auditing, and general network scanning, proving its reliability in the networking and security space.

What is the most powerful nmap scan? ›

Let's get to know a few useful command-line based best Nmap scans that can be performed.
  1. Basic Nmap Scan against IP or host. ...
  2. Nmap Ping Scan. ...
  3. Scan specific ports or scan entire port ranges on a local or remote server. ...
  4. Scan multiple IP addresses. ...
  5. Scan IP ranges. ...
  6. Scan the most popular ports.
Apr 11, 2024

What is the quickest Nmap scan? ›

If you need to perform a scan quickly, you can use the -F flag. The -F flag will list ports on the nmap-services files. Because the -F "Fast Scan" flag does not scan as many ports, it isn't as thorough. Note: Learn about other methods you can use to check for open ports in Linux.

How do I scan all IP addresses in Nmap? ›

To make Nmap scan all the resolved addresses instead of only the first one, use the --resolve-all option. Sometimes you wish to scan a whole network of adjacent hosts. For this, Nmap supports CIDR-style addressing.

What is the most powerful Nmap scan? ›

Let's get to know a few useful command-line based best Nmap scans that can be performed.
  1. Basic Nmap Scan against IP or host. ...
  2. Nmap Ping Scan. ...
  3. Scan specific ports or scan entire port ranges on a local or remote server. ...
  4. Scan multiple IP addresses. ...
  5. Scan IP ranges. ...
  6. Scan the most popular ports.
Apr 11, 2024

How do I scan all 65535 ports in Nmap? ›

Scanning specific port ranges

There are several ways of using the Nmap -p option: Port list separated by commas: $ nmap -p80,443 localhost. Port range denoted with hyphens: $ nmap -p1-100 localhost. Alias for all ports from 1 to 65535: # nmap -p- localhost.

What is the difference between Nmap sS and Nmap sT? ›

With -sS the TCP the packet flow is SYN - SYN/ACK - RST. The service that is listening on the port won't notice since the handshake never completes. On the other hand, -sT performs a proper handshake (SYN - SYN/ACK - ACK) which establishes a connection, so the service notices. Thus, -sS is stealthier than -sT.

Top Articles
Latest Posts
Article information

Author: Rubie Ullrich

Last Updated:

Views: 5552

Rating: 4.1 / 5 (72 voted)

Reviews: 95% of readers found this page helpful

Author information

Name: Rubie Ullrich

Birthday: 1998-02-02

Address: 743 Stoltenberg Center, Genovevaville, NJ 59925-3119

Phone: +2202978377583

Job: Administration Engineer

Hobby: Surfing, Sailing, Listening to music, Web surfing, Kitesurfing, Geocaching, Backpacking

Introduction: My name is Rubie Ullrich, I am a enthusiastic, perfect, tender, vivacious, talented, famous, delightful person who loves writing and wants to share my knowledge and understanding with you.