Performs brute force password auditing against http form-based authentication.
This script uses the unpwdb and brute libraries to perform password guessing. Any successful guesses are stored in the nmap registry, using the creds library, for other scripts to use.
The script automatically attempts to discover the form method, action, and field names to use in order to perform password guessing. (Use argument path to specify the page where the form resides.) If it fails doing so the form components can be supplied using arguments method, path, uservar, and passvar. The same arguments can be used to selectively override the detection outcome.
After attempting to authenticate using a HTTP GET or POST request the script analyzes the response and attempts to determine whether authentication was successful or not. The script analyzes this by checking the response using the following rules: 1. If the response was empty the authentication was successful. 2. If the onsuccess argument was provided then the authentication either succeeded or failed depending on whether the response body contained the message/pattern passed in the onsuccess argument. 3. If no onsuccess argument was passed, and if the onfailure argument was provided then the authentication either succeeded or failed depending on whether the response body does not contain the message/pattern passed in the onfailure argument. 4. If neither the onsuccess nor onfailure argument was passed and the response contains a form field named the same as the submitted password parameter then the authentication failed. 5. Authentication was successful.
identifies the page that contains the form (default: "/"). The script analyses the content of this page to determine the form destination, method, and fields. If argument passvar is specified then the form detection is not performed and the path argument is instead used as the form submission destination (the form action). Use the other arguments to define the rest of the form manually as necessary.
(optional) sets the message/pattern to expect on unsuccessful authentication
sets the host header in case of virtual hosting
sets the http-variable name that holds the password used to authenticate. If this argument is set then the form detection is not performed. Use the other arguments to define the form manually.
(optional) sets the message/pattern to expect on successful authentication
(optional) sets the form field name that holds the username used to authenticate.
sets the HTTP method (default: "POST")
creds.[service], creds.globalSee the documentation for the creds library.
smbdomain, smbhash, smbnoguest, smbpassword, smbtype, smbusernameSee the documentation for the smbauth library.
brute.credfile, brute.delay, brute.emptypass, brute.firstonly, brute.guesses, brute.mode, brute.passonly, brute.retries, brute.threads, brute.unique, brute.useraspassSee the documentation for the brute library.
passdb, unpwdb.passlimit, unpwdb.timelimit, unpwdb.userlimit, userdbSee the documentation for the unpwdb library.
http.max-cache-size, http.max-pipeline, http.pipeline, http.useragentSee the documentation for the http library.
nmap --script http-form-brute -p 80 <host>
PORT STATE SERVICE REASON 80/tcp open http syn-ack | http-brute: | Accounts | Patrik Karlsson:secret - Valid credentials | Statistics |_ Perfomed 60023 guesses in 467 seconds, average tps: 138
Author: Patrik Karlsson, nnposter
License: Same as Nmap--See https://nmap.org/book/man-legal.html