Nmap http-enum NSE Script


This page contains detailed information about how to use the http-enum NSE script. For list of all NSE scripts, visit the Nmap NSE Library.

Select:
Overview
Error Messages

Script Overview


Script source code: https://github.com/nmap/nmap/tree/master/scripts/http-enum.nse
Script categories: discovery, intrusive, vuln
Target service / protocol: http, https
Target network port(s): 80, 443, 631, 7080, 8080, 8443, 8088, 5800, 3872, 8180, 8000
List of CVEs: -

Script Description


The http-enum.nse script enumerates directories used by popular web applications and servers.

This parses a fingerprint file that's similar in format to the Nikto Web application scanner. This script, however, takes it one step further by building in advanced pattern matching as well as having the ability to identify specific versions of Web applications.

You can also parse a Nikto-formatted database using http-fingerprints.nikto-db-path. This will try to parse most of the fingerprints defined in nikto's database in real time. More documentation about this in the nselib/data/http-fingerprints.lua file.

Currently, the database can be found under Nmap's directory in the nselib/data folder. The file is called http-fingerprints and has a long description of its functionality in the file header.

Many of the finger prints were discovered by me (Ron Bowes), and a number of them are from the Yokoso project, used with permission from Kevin Johnson (http://seclists.org/nmap-dev/2009/q3/0685.html).

Initially, this script attempts to access two different random files in order to detect servers that don't return a proper 404 Not Found status. In the event that they return 200 OK, the body has any non-static-looking data removed (URI, time, etc), and saved. If the two random attempts return different results, the script aborts (since a 200-looking 404 cannot be distinguished from an actual 200). This will prevent most false positives.

In addition, if the root folder returns a 301 Moved Permanently or 401 Authentication Required, this script will also abort. If the root folder has disappeared or requires authentication, there is little hope of finding anything inside it.

By default, only pages that return 200 OK or 401 Authentication Required are displayed. If the http-enum.displayall script argument is set, however, then all results will be displayed (except for 404 Not Found and the status code returned by the random files). Entries in the http-fingerprints database can specify their own criteria for accepting a page as valid.

Http-enum NSE Script Arguments


This is a full list of arguments supported by the http-enum.nse script:

http-enum.basepath

The base path to prepend to each request. Leading/trailing slashes are ignored.

http-enum.category

Set to a category (as defined in the fingerprints file). Some options are 'attacks', 'database', 'general', 'microsoft', 'printer', etc.

http-enum.displayall

Set this argument to display all status codes that may indicate a valid page, not just 200 OK and 401 Authentication Required pages. Although this is more likely to find certain hidden folders, it also generates far more false positives.

http-enum.fingerprintfile

Specify a different file to read fingerprints from.

http-fingerprints.nikto-db-path

Looks at the given path for nikto database. It then converts the records in nikto's database into our Lua table format and adds them to our current fingerprints if they don't exist already. Unfortunately, our current implementation has some limitations: * It doesn't support records with more than one 'dontmatch' patterns for a probe. * It doesn't support logical AND for the 'match' patterns. * It doesn't support sending additional headers for a probe. That means, if a nikto fingerprint needs one of the above features, it won't be loaded. At the time of writing this, 6546 out of the 6573 Nikto fingerprints are being loaded successfully. This runtime Nikto fingerprint integration was suggested by Nikto co-author Chris Sullo as described at http://seclists.org/nmap-dev/2013/q4/292

smbdomain

The domain to log in with. If you aren't in a domain environment, then anything will (should?) be accepted by the server.

smbhash

A password hash to use when logging in. This is given as a single hex string (32 characters) or a pair of hex strings (both 32 characters, optionally separated by a single character). These hashes are the LanMan or NTLM hash of the user's password, and are stored on disk or in memory. They can be retrieved from memory using the fgdump or pwdump tools.

smbnoguest

Use to disable usage of the 'guest' account.

smbpassword

The password to connect with. Be cautious with this, since some servers will lock accounts if the incorrect password is given. Although it's rare that the Administrator account can be locked out, in the off chance that it can, you could get yourself in trouble. To use a blank password, leave this parameter off altogether.

smbtype

The type of SMB authentication to use. These are the possible options:

  • v1: Sends LMv1 and NTLMv1.
  • LMv1: Sends LMv1 only.
  • NTLMv1: Sends NTLMv1 only (default).
  • v2: Sends LMv2 and NTLMv2.
  • LMv2: Sends LMv2 only.
  • NTLMv2: Doesn't exist; the protocol doesn't support NTLMv2 alone. The default, NTLMv1, is a pretty decent compromise between security and compatibility. If you are paranoid, you might want to use v2 or lmv2 for this. (Actually, if you're paranoid, you should be avoiding this protocol altogether!). If you're using an extremely old system, you might need to set this to v1 or lm, which are less secure but more compatible. For information, see smbauth.lua.

smbusername

The SMB username to log in with. The forms "DOMAIN\username" and "username@DOMAIN" are not understood. To set a domain, use the smbdomain argument.

slaxml.debug

Debug level at which default callbacks will print detailed parsing info. Default: 3

http.host

The value to use in the Host header of all requests unless otherwise set. By default, the Host header uses the output of stdnse.get_hostname().

http.max-body-size

Limit the received body to specific number of bytes. An oversized body results in an error unless script argument http.truncated-ok or request option truncated_ok is set to true. The default is 2097152 (2MB). Use value -1 to disable the limit altogether. This argument can be overridden case-by-case with request option max_body_size.

http.max-cache-size

The maximum memory size (in bytes) of the cache.

http.max-pipeline

If set, it represents the number of outstanding HTTP requests that should be sent together in a single burst. Defaults to http.pipeline (if set), or to what function get_pipeline_limit returns.

http.pipeline

If set, it represents the number of HTTP requests that'll be sent on one connection. This can be set low to make debugging easier, or it can be set high to test how a server reacts (its chosen max is ignored).

http.truncated-ok

Do not treat oversized body as error. (Use response object flag truncated to check if the returned body has been truncated.) This argument can be overridden case-by-case with request option truncated_ok.

http.useragent

The value of the User-Agent header field sent with requests. By default it is "Mozilla/5.0 (compatible; Nmap Scripting Engine; https://nmap.org/book/nse.html)". A value of the empty string disables sending the User-Agent header field.

- - -
To use these script arguments, add them to the Nmap command line using the --script-args arg1=value,[arg2=value,..] syntax. For example:

nmap --script=http-enum --script-args http-enum.basepath=value,http-enum.category=value <target>

Http-enum NSE Script Example Usage


Here's an example of how to use the http-enum.nse script:

nmap --script=http-enum <target>

Http-enum NSE Script Example Output


Here's a sample output from the http-enum.nse script:

Interesting ports on test.skullsecurity.org (208.81.2.52):
PORT   STATE SERVICE REASON
80/tcp open  http    syn-ack
| http-enum:
|   /icons/: Icons and images
|   /images/: Icons and images
|   /robots.txt: Robots file
|   /sw/auth/login.aspx: Citrix WebTop
|   /images/outlook.jpg: Outlook Web Access
|   /nfservlets/servlet/SPSRouterServlet/: netForensics
|_  /nfservlets/servlet/SPSRouterServlet/: netForensics

Http-enum NSE Script Example XML Output


There is no sample XML output for this module. However, by providing the -oX <file> option, Nmap will produce a XML output and save it in the file.xml file.

Authors


  • Ron Bowes
  • Andrew Orr
  • Rob Nicholls

References


See Also


Visit Nmap NSE Library for more scripts.

The http-enum.nse script may fail with the following error messages. Check for the possible causes by using the code snippets highlighted below found in the script source code. This can often times help in identifying the root cause of the problem.

Invalid path found for fingerprint


Here is a relevant code snippet related to the "Invalid path found for fingerprint " error message:

228:	
229:	    -- Make sure they have either a string or a table of probes
230:	    if(not(fingerprint.probes) or
231:	        (type(fingerprint.probes) ~= 'table' and type(fingerprint.probes) ~= 'string') or
232:	        (type(fingerprint.probes) == 'table' and #fingerprint.probes == 0)) then
233:	      return bad_prints(mutex, "Invalid path found for fingerprint " .. i)
234:	    end
235:	
236:	    -- Make sure fingerprint.path is a table
237:	    if(type(fingerprint.probes) == 'string') then
238:	      fingerprint.probes = {fingerprint.probes}

http.pipeline_go encountered an error


Here is a relevant code snippet related to the "http.pipeline_go encountered an error" error message:

428:	  -- Perform all the requests.
429:	  local results = http.pipeline_go(host, port, all)
430:	
431:	  -- Check for http.pipeline error
432:	  if(results == nil) then
433:	    stdnse.debug1("http.pipeline_go encountered an error")
434:	    return stdnse.format_output(false, "http.pipeline_go encountered an error")
435:	  end
436:	
437:	  -- Loop through the fingerprints. Note that for each fingerprint, we may have multiple results
438:	  local j = 1

http.pipeline_go encountered an error


Here is a relevant code snippet related to the "http.pipeline_go encountered an error" error message:

429:	  local results = http.pipeline_go(host, port, all)
430:	
431:	  -- Check for http.pipeline error
432:	  if(results == nil) then
433:	    stdnse.debug1("http.pipeline_go encountered an error")
434:	    return stdnse.format_output(false, "http.pipeline_go encountered an error")
435:	  end
436:	
437:	  -- Loop through the fingerprints. Note that for each fingerprint, we may have multiple results
438:	  local j = 1
439:	  local j_nopipeline = 1

Version


This page has been created based on Nmap version 7.92.

Go back to menu.