A change board asks which NSE script categories may run against production hosts in an authorised audit; what do you allow, and what does the safe label not promise?
answer
- a label, not a sandbox
- the script's author picks the category
- some scripts talk to third parties
- preview names before approving
- brute, dos, exploit, fuzzer need sign-off
basics
~20 sAllow only previewed scripts in the safe category, and require separate written authorisation for intrusive, brute, dos, exploit and fuzzer. Safe is the author's own label, not a guarantee, and it says nothing about scripts that send data to third parties.
solid answer
~40 sI turn categories into an approved list of script names for one pinned Nmap release: expand the proposed expression with `--script-help` and have the board sign that list. `safe` marks scripts the authors did not design to crash services, use large bandwidth or exploit holes, and they say they cannot guarantee it; in the 7.991 index two scripts carry both `safe` and `intrusive`. `intrusive`, `brute`, `dos`, `exploit` and `fuzzer` each need separate written authorisation and a window agreed with the system owner. `external` scripts send data to third parties, and `vuln` is not a safety class: 57 of the 105 `vuln` scripts are also `intrusive`. I rehearse the approved selection on a staging copy first.
code
bash · 5 lines# Resolve the proposed selection to names and categories for the change record
nmap --script-help "safe and not external"
# Run exactly that selection, inside the signed scope
nmap -sV --script "safe and not external" -oX audit-198-51-100.xml 198.51.100.0/28go deeper
Recall that safe and intrusive are the two main labels, and that brute, dos, exploit and fuzzer scripts are never part of a routine production scan.
Explain that script authors write the categories in each file, that script.db indexes them, and that --script-help shows names and categories before anything runs.
Convert categories into an approved list of script names for a pinned release, treat external and broadcast scripts as data-flow and scope questions, and rehearse on staging.
Own the policy: who may approve each category, how the approved list is re-verified when Nmap or its scripts change, and how exceptions are logged.
## Categories as a safety classification Every NSE script declares one or more categories in its own file, and Nmap indexes them in `scripts/script.db`. Names are not case sensitive. A change board can use them as a first filter, provided it knows what each one claims: | Category | What Nmap says it means | Production stance | |---|---|---| | `safe` | Not designed to crash services, use large amounts of bandwidth or other resources, or exploit security holes. No guarantee. | Allow after preview | | `intrusive` | Risk is too high that it crashes the target, uses significant resources or is perceived as malicious. | Separate authorisation | | `default` | The curated set that `-sC` and `-A` run. | Preview it; still a scan | | `discovery` | Actively learns more about the network from registries, SNMP-enabled devices, directory services and the like. | Depends on its other tags | | `version` | Extends version detection; runs when `-sV` is requested. | Follows the `-sV` approval | | `vuln` | Checks for specific known vulnerabilities and generally reports only when it finds one. | Not a safety class | | `external` | May send data to a third-party resource. | Data-sharing approval | | `broadcast` | Discovers hosts by broadcasting on the local network. | Scope approval | | `auth` | Deals with authentication credentials. | Read each script | | `brute`, `dos`, `exploit`, `fuzzer` | Scripts that attack authentication, may cause a denial of service, actively exploit a flaw, or send unexpected or randomised input. | Separate authorisation | | `malware` | Tests whether the target is infected or backdoored. | Read each script | ## Why a category is a label and not a control - The **author** of each script writes its `categories` field. The documentation describes no check that the action behaves the way its label says, and the reference guide states that scripts are not run in a sandbox. - The book says every script outside `version` should be either `safe` or `intrusive`. The 7.991 index does not hold to that: two scripts carry both tags, and 23 scripts outside `version` carry neither (12 of them are tagged `exploit`). Do not infer "not intrusive, therefore safe". - `ssl-enum-ciphers` is tagged `discovery` and `intrusive`. Its own description says it initiates many connections and is quite noisy, even though all it does is list accepted cipher suites. Benign-looking work can still be heavy. - Being `safe` does not make a script quiet. Safe scripts still open connections, produce log lines and may trip alerts. ## Beyond the target: external and broadcast - **`external`**: in the 7.991 index 33 scripts carry it and 27 of those are also `safe`. The `vulners` script (`vuln`, `safe`, `external`) looks up each detected software name and version or CPE against a remote service, so inventory details leave the audited network. `whois-ip` sends the target address to registries. Treat the category as a data-handling question for the owner. - **`broadcast`**: these scripts find hosts that were not on the command line. They add them to the scan queue only if the `newtargets` script argument is given. Leaving that argument out keeps the signed target list as the scope. - Scripts can also surprise by following links. The 7.991 changelog records a fix for `http-referer-checker`, which had been fetching off-host URLs. ## An approval workflow 1. Take the proposed expression, for example `"safe and not external"`, and expand it with `nmap --script-help "<expression>"`. Attach the name and category listing, with the Nmap version, to the change record. 2. Remove `external` and `broadcast` unless the data flow or the wider discovery is approved on its own. 3. Review any script that is also `vuln`, `auth` or `malware` individually; the tag combination tells you more than one category does. 4. Run the approved selection against a staging copy and read the target's own logs for what it did. 5. Obtain written authorisation, with window and contact, before anything in `intrusive`, `brute`, `dos`, `exploit` or `fuzzer`. That authorisation process belongs to the engagement, not to the scan plan. 6. Re-verify the list when the Nmap release changes. ## What to tell the board The category is a first filter and the script name list is the approval. The author's word is the only evidence behind a tag, so the board is approving observed behaviour on a rehearsal, not a label.
- Why is excluding external scripts a data-handling decision and not only a load decision?External scripts may send the target address, or for `vulners` the software name and version, to a service outside the audited network, and its operator can record it. That is information leaving the estate under the owner's name, so it needs its own approval. `--script "safe and not external"` keeps it out.
- What keeps a broadcast-category script from widening the scan beyond the signed target list?By default nothing is added: such scripts add discovered hosts to the queue only when the `newtargets` script argument is given. So review every `--script-args` in the run plan, leave `newtargets` out of a scoped audit, and compare the final host list with the signed one.
- How do you see which categories a particular script declares?`nmap --script-help <name>` prints the script's name, categories and description. The same `categories` table is at the top of the `.nse` file and in `scripts/script.db`. After adding or recategorising a local script, `--script-updatedb` refreshes the index.
A category is the hazard sticker a manufacturer prints on a box: it helps you plan how to handle the box, but it is not a lock on the box, and the manufacturer says so on the label.
- safe means the script cannot affect the target
- Anything in the vuln category is a harmless check
- Nmap sandboxes scripts, so the category choice hardly matters
- Scripts only ever talk to the hosts named on the command line
- If a script is not intrusive it must be safe
- One approval of a category covers every future Nmap release
Assumes Nmap 7.991: counts and tag combinations are read from that release's scripts/script.db and script files; other releases differ.