In a web server's access log, what does the Nmap Scripting Engine's default User-Agent tell the owner, and what can it not prove?
answer
- a default header, not an identity
- set by the shared HTTP library
- match source and time to the ticket
- absence proves nothing
- the string carries nmap.org/book/nse.html
basics
~20 sScripts that use Nmap's HTTP library send the User-Agent Mozilla/5.0 (compatible; Nmap Scripting Engine; https://nmap.org/book/nse.html) by default, a good hint of an NSE web script. It is a client-chosen header, so match source and time to the scan ticket and never read its absence as proof.
solid answer
~40 sIn 7.991, `nselib/http.lua` sets the default User-Agent `Mozilla/5.0 (compatible; Nmap Scripting Engine; https://nmap.org/book/nse.html)` for every script that uses the HTTP library, so it appears when scripts such as `http-title` fetch pages. The owner can treat it as a strong hint of NSE web scripts and match the source address and time to the authorised window. It cannot prove who ran the scan, since anyone can run Nmap, and it cannot prove absence: scripts for other protocols never send it, and the client chooses its own header. Version detection's HTTP probe is a bare `GET / HTTP/1.0` without it. An unticketed source is handled as an unplanned scan.
go deeper
Recall that NSE web scripts send an identifiable Nmap Scripting Engine User-Agent by default and that a log line like that deserves a check against the scan ticket.
Explain that the header comes from the shared HTTP library, that -sV probes and non-HTTP scripts do not carry it, and what each tells the owner.
Show the correlation habit: match source, time and paths to the authorised window, treat the string as a low-confidence signal, and never accept its absence as evidence.
Set the process: assessors publish sources and windows ahead of time, the monitoring team uses the string for confirmation, and unticketed matches follow the incident path.
## Where the header comes from NSE scripts that speak HTTP do it through a shared library, `http`. In the Nmap 7.991 source that library defines a default `User-Agent` of: ``` Mozilla/5.0 (compatible; Nmap Scripting Engine; https://nmap.org/book/nse.html) ``` The library documents it as the default value of the header, and a script argument for the library can set another value. Because the setting belongs to the library, it applies to every script that uses it, for example `http-title`, which fetches a web server's default page and follows up to five redirects under the library's default rules. ## What the owner can conclude - A request line carrying the string came from a script running on the Nmap Scripting Engine, and the script used the `http` library. That is far more specific than "someone is probing". - The paths requested hint at which script ran: a single request for `/` fits a title or header check, while a run of distinct requests suggests a fuller selection. - The timing, source address and rate can be compared with the audit's window, target list and contact. If all three match a ticket, the line is the assessor's, which is exactly what a log should let you confirm. - If none matches, treat it as an unplanned scan and handle it through the incident process. ## What the owner cannot conclude - **Who ran it.** Nmap is free and the string is public. The header cannot separate an authorised assessor from anyone else. - **That nothing else happened.** NSE scripts for other protocols never send an HTTP User-Agent. A web server's log says nothing about them. - **That no scan occurred.** The header is chosen by the client, so a scan that did happen may carry another value or none, and port probes alone produce no HTTP request. - **Which script and why.** The string names the engine, not a script, and not an intent. ## Related traffic with no header Version detection (`-sV`) sends probes from `nmap-service-probes`. Its `GetRequest` probe is exactly `GET / HTTP/1.0` followed by a blank line: no `User-Agent`, no `Host` header. A bare HTTP/1.0 request from the same source at the same time is consistent with version detection, and a request with the Nmap string is consistent with a web script. Seeing both from one address in one window is the typical shape of a `-sV` plus script run. | Traffic | What the web log shows | Header | |---|---|---| | Port scan without HTTP | nothing; connections only in network logs | none | | `-sV` HTTP probe | `GET / HTTP/1.0` | none | | NSE web script | one or more requests | default string unless changed | | NSE script for another protocol | nothing in the web log | none | ## What else to read in the log The header is one field among several. For a web script the useful companions are the request path and method, the status codes returned, the number of distinct paths per minute, and whether the same source also shows connections to unrelated ports in the network logs. A banner-style script and a fuller selection leave different footprints, and a quick reading of those footprints tells the owner whether the activity matches the scripts the audit plan listed. If the plan named `http-title` only, a dozen distinct paths is a mismatch worth raising with the assessor. ## Using it as a control 1. Agree the assessor's source addresses and window in advance and give them to the monitoring team, so the line can be matched rather than argued about. 2. Treat a match on the string as a low-cost, low-confidence signal and correlate it with the network logs. Writing the actual detection rule belongs to the network-defence material. 3. Keep scripts' own record: the assessor can supply the `--script-trace` output, which lists every communication a script made, to reconcile with the access log. 4. Do not rely on the string as the only detection. Its value is as a confirmation, not as a gate. ## A short scenario At 02:10 an access log shows twenty requests from `203.0.113.40` with the Nmap Scripting Engine string, and the audit ticket allows the window 02:00 to 04:00 from that address. The owner confirms with the assessor's contact and closes the alert. If the source were `198.51.100.77`, the same lines would start an incident ticket instead.
- Which Nmap activity on a web port leaves a request with no User-Agent at all?Version detection (`-sV`): one of its HTTP probes, `GetRequest`, is `GET / HTTP/1.0` followed by a blank line, per `nmap-service-probes`. So a bare HTTP/1.0 root request from the same source at the same time is consistent with version detection, while the Nmap Scripting Engine string points to a web script. Use both as hints.
- What should the owner do when the string appears from a source that is in no scan ticket?Treat it as an unplanned scan: record the lines, check the source against the assessors' published addresses, and escalate through the incident process. The string is a hint, not attribution. Preventing this repeating means agreeing sources and windows with the monitoring team before each audit.
- The Nmap User-Agent proves an attacker, not an auditor, is scanning
- No Nmap User-Agent in the log means no Nmap scan reached the server
- Every Nmap probe carries that User-Agent
- Filtering that header value is a complete defence against NSE web scripts
- The User-Agent string names the script that ran
Assumes Nmap 7.991, where nselib/http.lua sets this default User-Agent string; other releases may differ.