nmap

Using nmap for Cybersecurity

Knowing how to use nmap is critically important for cybersecurity professionals because it is one of the most powerful and versatile tools for network reconnaissance, security auditing, and vulnerability assessment. Nmap is to cybersecurity what a stethoscope is to a doctor—a diagnostic tool that’s fundamental to identifying issues, assessing risk, and maintaining a secure environment. When focusing on cybersecurity, you’re typically using Nmap for reconnaissance, vulnerability assessment, and service enumeration.

We have previous posts that get you started on nmap if you are new:

But what if your focus is on Cybersecurity? Hackers absolutely use nmap, and it’s one of their most common tools for reconnaissance.

Both Ethical and Malicious Hackers Use nmap

Ethical Hackers (e.g., Penetration Testers, Red Teams)

  • Use nmap legally to assess network security.
  • Help organizations identify vulnerabilities, misconfigurations, and exposed services.
  • Perform reconnaissance in a controlled and authorized environment.

Malicious Hackers (Black Hats)

  • Use nmap for network scanning and footprinting before launching attacks.
  • Identify:
    • Open ports
    • Running services
    • Operating system fingerprints
    • Vulnerable hosts
  • Conduct stealth scans (e.g., SYN scan, NULL scan) to avoid detection by firewalls or intrusion detection systems (IDS).

Common Nmap Uses by Hackers

TechniqueWhat it DoesWhy It’s Useful to Hackers
nmap -sSSYN (stealth) scanHarder to detect; identifies open ports
nmap -OOS detectionHelps tailor exploits to the host
nmap -sVService version detectionFinds known vulnerable software versions
nmap --scriptNSE scriptsAutomates vulnerability detection (e.g., CVEs, SMB, SSL issues)
nmap -PnSkip pingScans networks where ping is blocked

If you’re a defender or cybersecurity analyst, understanding how attackers use nmap helps you to recognize scanning behavior in logs, harden systems against common scans and configure firewalls and IDS to detect or block reconnaissance attempts for example. The key point is that nmap itself is not malicious—it’s a legitimate tool. But like a lock pick, its use depends on intent and authorization. So NEVER SCAN WITHOUT PERMISSION/AUTHORIZATION especially in production networks.

With all that said, let’s look at some examples of how to use nmap for Cybersecurity.

Network Discovery

ARP scanning on your local LAN or VLANnmap -sn -PR 192.168.1.0/24
Basic and Limited scan (ping plus TCP port 80 and 443)nmap -sn 192.168.1.0/24
ICMP (echo request) only scannmap -sn -PE 192.168.1.0/24
DNS Lookup without scanning targetsnmap -n -sn 192.168.1.0/24
Passive Listening and Mapping of manufacturers/vendorsnmap -sP 192.168.1.0/24 –script broadcast-listener
Service and Version Detection of a target hostnmap -sV 192.168.1.1
Service and Version Detection of a target host with OS fingerprintingnmap -sS -sV -O 192.168.1.1

Vulnerability Sanning

Check a target host for known vulnerabilitiesnmap –script vuln 192.168.1.1
Check a target host for SMB vulnerabilitiesnmap -p 445 –script smb-vuln* 192.168.1.1
Check a target host for HTTP misconfigurationsnmap -p 80,443 –script http-enum,http-config-backup 192.168.1.1

Port Scanning

Scan a Single Target Host (using default TCP ports)nmap 192.168.1.1
nmap -sS 192.168.1.1 (this use uses more stealthy SYN scans)
Scan a Single Target Host (using default UCP ports)nmap -sU 192.168.1.1
Scan a Single Target Host (using all TCP ports)nmap 192.168.1.1 -p-
nmap -sS 192.168.1.1 -p- (this use uses more stealthy SYN scans)
Scan a LAN/VLAN for the top 10 TCP ports being usednmap 192.168.1.0/24 –tcp-ports 10
Scan for MobBus instancesnmap 192.168.1.0/24 -p 502
nmap -p 502 –script modbus-discover 192.168.1.0/24 (or specific target)

Scan Speed Adjustment

Speed Options
Scan speed is critically important when using nmap because it directly impacts the effectiveness, detectability, and accuracy of your scan.
-T0 is “paranoid” meaning slow
-T1 is “sneaky”
-T2 is “polite”
-T3 is normal
-T4 is “aggressive”
-T5 is “insane”
Control over scan speednmap 192.168.1.1 -T2
Send only one packet at a timenmap 192.168.1.1 –max-parallelism 1
Limit when packets are sent based on time – 10 seconds in this examplenmap 192.168.1.1 –scan-delay 10s

Exporting Scan Results for Reporting

Normal Text (formal)add -oN to the nmap command
XML add -oX to the nmap command
Grep-able add -oG to the nmap command

nmap Scripting Engine for Cybersecurity

Enumerate Ethernet/IP Details of a targetnmap 192.168.1.1 -p 5044818 2 –script enip-info
Enumerate ModBus Details of a targetnmap 192.168.1.1 -p 502 –script modbus-discover
Enumerate Siemens S7 Details of a targetnmap 192.168.1.1 -p 102 –script s7-info
Enumerate DNP3 Details of a targetnmap 192.168.1.1 -p 200000 –script dnp3-info

Some other nmap Command Options When Scanning for Cybersecurity

PurposeKey Option(s)
Host discovery-sn
TCP port scan-sS
UDP port scan-sU
Service/version detection-sV
OS detection-O
Vulnerability scripts--script vuln
Evade firewalls-f, -D, -T0 to -T2
Save reports-oA, -oN, -oX

Some Other Ports of Possible Interest to Scan

BACnetUDP 47808TridiumTCP 1911
OPC UATCP 4840PCWorxTCP 1962
MQTT #1TCP 1883Red LionTCP 789
MQTT #2TCP 8883ProConOSTCP 20547
MQTT-SNUDP 1884GE-STRPTCP 18245
HART-IPTCP 5094FINS /TCP/UDP 9600
MELSEC-QTCP 5007OmronTCP/UDP 9600

I hope this helps those of you working in Cybersecurity and OT/ICS (Operational Technology / Industrial Control Systems).


Comments are welcomed below from registered users.  You can also leave comments at our Discord server

If you would like to see more content and articles like this, please support us by clicking the patron link where you will receive free bonus access to courses and more, or simply buying us a cup of coffee!

Leave a Comment

Scroll to Top