Nmap Scripting Engine Guide: Categories, Safe Scripts and Usage

The Nmap Scripting Engine (NSE) lets Nmap run Lua scripts that collect extra information about hosts and services, such as TLS details, HTTP titles or SMB settings, and check for some known vulnerabilities. Scripts are grouped into categories like default, safe, discovery, version, vuln and intrusive.

Mar 27, 2025 - 12:01
Updated: 
111k

Security Tools, Authorized Labs & CTFs in Cybersecurity & Ethical Hacking · Tutorial

Network Security, Ethical Hacking, Cyber Threats, Scams & Online Safety

Nmap Scripting Engine Guide: Categories, Safe Scripts and Usage

Quick answer: The Nmap Scripting Engine (NSE) lets Nmap run Lua scripts that collect extra information about hosts and services, such as TLS details, HTTP titles or SMB settings, and check for some known vulnerabilities. Scripts are grouped into categories like default, safe, discovery, version, vuln and intrusive. Run nmap -sC for the default set, --script safe for low-risk checks, and read --script-help before using any script you do not know. Intrusive, brute and dos scripts can lock accounts or crash services. Run NSE only against systems you own or have written permission to scan.

Key takeaways

  • NSE extends Nmap with Lua scripts grouped into categories.
  • -sC runs the default category, which Nmap designs to be reasonably safe.
  • Check --script-help before running unfamiliar scripts.
  • Intrusive categories need explicit approval in your rules of engagement.
  • Scanning without permission can be an offence in India.

Table of Contents

What Is the Nmap Scripting Engine?

NSE is built into Nmap and runs scripts written in Lua during or after a scan. The Nmap book chapter on NSE lists its main uses: network discovery, better version detection, vulnerability detection and backdoor detection. Every script is documented in the NSEDoc portal. For Nmap basics, see understanding Nmap for vulnerability scanning.

What Are the NSE Script Categories?

CategoryPurposeRisk level
defaultRun by -sC; useful and fastLow
safeNot designed to crash services or be intrusiveLow
discoveryLearn more about the network and servicesLow to medium
versionExtends -sV version detectionLow
broadcastDiscover hosts by broadcasting on the local networkLow to medium
externalSends data to third-party servicesPrivacy concern
vulnCheck for specific known vulnerabilitiesMedium
authDeal with authentication settingsMedium
intrusiveMay crash services or use many resourcesHigh
bruteGuess credentialsHigh, lockouts
dosMay cause denial of serviceHigh
exploitTry to exploit a vulnerabilityHigh
fuzzerSend unexpected inputHigh
malwareDetect signs of infection or backdoorsLow to medium

These 14 categories are defined in the NSE usage documentation. A script can belong to several.

How Do You Tell Safe Scripts From Intrusive Ones?

Read the script's help before running it:

nmap --script-help ssl-cert
nmap --script-help "safe and discovery"
sudo nmap --script-updatedb

The help output lists categories and a description. The external category matters for privacy, because those scripts send target data to outside services, which may breach client confidentiality.

How Do You Run Scripts on an Authorised Target?

Examples against a lab host you own (192.168.56.10):

nmap -sV -sC 192.168.56.10
nmap -p 443 --script ssl-cert,ssl-enum-ciphers 192.168.56.10
nmap -p 80,443 --script http-title,http-headers 192.168.56.10
nmap --script "safe and not external" 192.168.56.10

Boolean expressions with and, or and not are supported, as described in the NSE reference guide. Use them to exclude risky categories explicitly.

How Do Script Arguments and Output Work?

OptionUse
--script-argsPass settings, such as http.useragent
--script-traceShow script traffic for debugging
-oA nameSave normal, XML and grepable output for the report
--script-timeoutStop slow scripts

Save output with -oA so findings can be verified and repeated after fixes. Release notes such as Nmap 7.96 list new and updated scripts.

How Do Defenders Use and Detect NSE?

Blue teams use safe scripts to audit their own estate: expired certificates, weak TLS ciphers, missing security headers and exposed SMB settings. To detect unwanted scanning, watch IDS alerts for NSE default HTTP user agents and many connections across ports from one source. Store these logs; CERT-In directions require 180-day log retention for many organisations in India.

The Nmap legal issues chapter advises getting permission before scanning networks you do not control. Plan tests under NIST SP 800-115 and remember that unauthorised access attempts can fall under Sections 43 and 66 of the IT Act 2000. WebAsha teaches Nmap in supervised labs within its ethical hacking training.

References

Frequently Asked Questions

A built-in Nmap feature that runs Lua scripts to gather more detail about hosts and services and to check for known issues.

It runs the scripts in the default category, which Nmap selects for being useful, fast and reasonably safe for most targets.

The Nmap documentation defines 14 categories, including default, safe, discovery, version, vuln, intrusive, brute, dos and exploit.

Run nmap --script-help with the script name and read its categories and description. Avoid intrusive, brute and dos scripts without approval.

Some can. Scripts in the intrusive, dos and fuzzer categories may crash services or consume many resources on the target.

External scripts send data to third-party services, which can expose client information and breach confidentiality agreements.

Run nmap --script-updatedb with administrator rights after adding or changing scripts, so category searches find them correctly.

No. Scan only systems you own or have written permission to test. Unauthorised scanning can create liability under the IT Act.

What's Your Reaction?

Like Like 0
Dislike Dislike 0
Love Love 0
Funny Funny 0
Wow Wow 0
Sad Sad 0
Angry Angry 0
Vaishnavi

Vaishnavi is a skilled tech professional at the Ethical Hacking Training Institute in Pune, responsible for managing and optimizing the technical infrastructure that supports advanced cybersecurity education. With deep expertise in network security, backend operations, and system performance, she ensures that practical labs, online modules, and assessments run smoothly and securely. Her behind-the-scenes contributions play a vital role in delivering a seamless and secure learning experience for aspiring ethical hackers.