nmap - Scripting Engine
Nmap Scripting Engine (NSE) is another handy feature of Nmap. It provides us with the possibility to create scripts in Lua for interaction with certain services. There are a total of 14 categories into which these scripts can be divided:
Category
Description
auth
Determination of authentication credentials.
broadcast
Scripts, which are used for host discovery by broadcasting and the discovered hosts, can be automatically added to the remaining scans.
brute
Executes scripts that try to log in to the respective service by brute-forcing with credentials.
default
Default scripts executed by using the -sC option.
discovery
Evaluation of accessible services.
dos
These scripts are used to check services for denial of service vulnerabilities and are used less as it harms the services.
exploit
This category of scripts tries to exploit known vulnerabilities for the scanned port.
external
Scripts that use external services for further processing.
fuzzer
This uses scripts to identify vulnerabilities and unexpected packet handling by sending different fields, which can take much time.
intrusive
Intrusive scripts that could negatively affect the target system.
malware
Checks if some malware infects the target system.
safe
Defensive scripts that do not perform intrusive and destructive access.
version
Extension for service detection.
vuln
Identification of specific vulnerabilities.
We have several ways to define the desired scripts in Nmap.
Default Scripts
$ sudo nmap <target> -sCSpecific Scripts Category
Defined Scripts
Example of declaring specific scripts
Scanning Options
Description
10.129.2.28
Scans the specified target.
-p 25
Scans only the specified port.
--script banner,smtp-commands
Uses specified NSE scripts.
Nmap - Aggressive Scan
Scanning Options
Description
10.129.2.28
Scans the specified target.
-p 25
Scans only the specified port.
-A
Performs service detection, OS detection, traceroute and uses defaults scripts to scan the target.
With the help of the used scan option (-A), we found out what kind of web server (Apache 2.4.29) is running on the system, which web application (WordPress 5.3.4) is used, and the title (blog.inlanefreight.com) of the web page. Also, Nmap shows that it is likely to be Linux (96%) operating system.
Vulnerability Assessment
Now let us move on to HTTP port 80 and see what information and vulnerabilities we can find using the vuln category from NSE.
Nmap - Vuln Category
Scanning Options
Description
10.129.2.28
Scans the specified target.
-p 80
Scans only the specified port.
-sV
Performs service version detection on specified ports.
--script vuln
Uses all related scripts from specified category.
The scripts used for the last scan interact with the webserver and its web application to find out more information about their versions and check various databases to see if there are known vulnerabilities. More information about NSE scripts and the corresponding categories we can find at: https://nmap.org/nsedoc/index.html
Last updated