Nmap oracle-brute-stealth NSE Script


This page contains detailed information about how to use the oracle-brute-stealth 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/oracle-brute-stealth.nse
Script categories: intrusive, brute
Target service / protocol: oracle-tns
Target network port(s): 1521
List of CVEs: CVE-2012-3137

Script Description


The oracle-brute-stealth.nse script exploits the CVE-2012-3137 vulnerability, a weakness in Oracle's O5LOGIN authentication scheme. The vulnerability exists in Oracle 11g R1/R2 and allows linking the session key to a password hash. When initiating an authentication attempt as a valid user the server will respond with a session key and salt. Once received the script will disconnect the connection thereby not recording the login attempt. The session key and salt can then be used to brute force the users password.

Oracle-brute-stealth NSE Script Arguments


This is a full list of arguments supported by the oracle-brute-stealth.nse script:

oracle-brute-stealth.accounts

A list of comma separated accounts to test

oracle-brute-stealth.johnfile

If specified the hashes will be written to this file to be used by JtR

oracle-brute-stealth.nodefault

Do not attempt to guess any Oracle default accounts

oracle-brute-stealth.sid

The instance against which to perform password guessing

creds.global

Credentials to be returned by Credentials.getCredentials regardless of the service.

creds.[service]

Credentials to be returned by Credentials.getCredentials for [service]. E.g. creds.http=admin:password

passdb

The filename of an alternate password database. Default: nselib/data/passwords.lst

unpwdb.passlimit

The maximum number of passwords passwords will return (default unlimited).

unpwdb.timelimit

The maximum amount of time that any iterator will run before stopping. The value is in seconds by default and you can follow it with ms, s, m, or h for milliseconds, seconds, minutes, or hours. For example, unpwdb.timelimit=30m or unpwdb.timelimit=.5h for 30 minutes. The default depends on the timing template level (see the module description). Use the value 0 to disable the time limit.

unpwdb.userlimit

The maximum number of usernames usernames will return (default unlimited).

userdb

The filename of an alternate username database. Default: nselib/data/usernames.lst

brute.credfile

A file containing username and password pairs delimited by '/'

brute.delay

The number of seconds to wait between guesses (default: 0)

brute.emptypass

Guess an empty password for each user (default: false)

brute.firstonly

Stop guessing after first password is found (default: false)

brute.guesses

The number of guesses to perform against each account. (default: 0 (unlimited)). The argument can be used to prevent account lockouts.

brute.mode

Can be user, pass or creds and determines what mode to run the engine in.

  • user - the unpwdb library is used to guess passwords, every password Password is tried for each user. (The user iterator is in the outer loop)
  • pass - the unpwdb library is used to guess passwords, each password Is tried for every user. (The password iterator is in the outer loop)
  • creds - a set of credentials (username and password pairs) are Guessed against the service. This allows for lists of known or common username and password combinations to be tested. If no mode is specified and the script has not added any custom iterator the pass mode will be enabled.

brute.passonly

Iterate over passwords only for services that provide only a password for authentication. (default: false)

brute.retries

The number of times to retry if recoverable failures occur. (default: 2)

brute.start

The number of threads the engine will start with. (default: 5).

brute.threads

The number of initial worker threads, the number of active threads will be automatically adjusted.

brute.unique

Make sure that each password is only guessed once (default: true)

brute.useraspass

Guess the username as password for each user (default: true)

creds.[service]

Credentials to be returned by Credentials.getCredentials for [service]. E.g. creds.http=admin:password

- - -
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=oracle-brute-stealth --script-args oracle-brute-stealth.accounts=value,oracle-brute-stealth.johnfile=value <target>

Oracle-brute-stealth NSE Script Example Usage


Here's an example of how to use the oracle-brute-stealth.nse script:

nmap --script oracle-brute-stealth -p 1521 --script-args oracle-brute-stealth.sid=ORCL <host>

Oracle-brute-stealth NSE Script Example Output


Here's a sample output from the oracle-brute-stealth.nse script:

PORT     STATE  SERVICE REASON
1521/tcp open  oracle  syn-ack
| oracle-brute-stealth:
|   Accounts
|     dummy:$o5logon$1245C95384E15E7F0C893FCD1893D8E19078170867E892CE86DF90880E09FAD3B4832CBCFDAC1A821D2EA8E3D2209DB6*4202433F49DE9AE72AE2 - Hashed valid or invalid credentials
|     nmap:$o5logon$D1B28967547DBA3917D7B129E339F96156C8E2FE5593D42540992118B3475214CA0F6580FD04C2625022054229CAAA8D*7BCF2ACF08F15F75B579 - Hashed valid or invalid credentials
|   Statistics
|_    Performed 2 guesses in 1 seconds, average tps: 2

Oracle-brute-stealth 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.

Author


  • Dhiru Kholia

References


See Also


Related NSE scripts to the oracle-brute-stealth.nse script:

Visit Nmap NSE Library for more scripts.

The oracle-brute-stealth.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.

ERROR: An Oracle %s error occurred


Here is a relevant code snippet related to the "ERROR: An Oracle %s error occurred" error message:

96:	      if ( tries < MAX_RETRIES ) then
97:	        stdnse.debug2("Attempting to re-connect (attempt %d of %d)", MAX_RETRIES - tries, MAX_RETRIES)
98:	      end
99:	      status, data = self.helper:Connect()
100:	      if ( not(status) ) then
101:	        stdnse.debug2("ERROR: An Oracle %s error occurred", data)
102:	        self.helper:Close()
103:	      else
104:	        break
105:	      end
106:	      tries = tries - 1

Oracle instance not set (see oracle-brute-stealth.sid or tns.sid)


Here is a relevant code snippet related to the "Oracle instance not set (see oracle-brute-stealth.sid or tns.sid)" error message:

152:	  local engine = brute.Engine:new(Driver, host, port, sid)
153:	  local arg_accounts = stdnse.get_script_args(SCRIPT_NAME .. '.accounts')
154:	  local mode = arg_accounts and "accounts" or "default"
155:	
156:	  if ( not(sid) ) then
157:	    return fail("Oracle instance not set (see oracle-brute-stealth.sid or tns.sid)")
158:	  end
159:	
160:	  if ( arg_johnfile ) then
161:	    johnfile = io.open(arg_johnfile, "w")
162:	    if ( not(johnfile) ) then

Failed to open %s for writing


Here is a relevant code snippet related to the "Failed to open %s for writing" error message:

158:	  end
159:	
160:	  if ( arg_johnfile ) then
161:	    johnfile = io.open(arg_johnfile, "w")
162:	    if ( not(johnfile) ) then
163:	      return fail(("Failed to open %s for writing"):format(johnfile))
164:	    end
165:	  end
166:	
167:	  local helper = tns.Helper:new( host, port, sid )
168:	  local status, result = helper:Connect()

Failed to connect to oracle server


Here is a relevant code snippet related to the "Failed to connect to oracle server" error message:

165:	  end
166:	
167:	  local helper = tns.Helper:new( host, port, sid )
168:	  local status, result = helper:Connect()
169:	  if ( not(status) ) then
170:	    return fail("Failed to connect to oracle server")
171:	  end
172:	  helper:Close()
173:	
174:	  if ( stdnse.get_script_args('userdb') or
175:	    stdnse.get_script_args('passdb') or

Failed to find %s


Here is a relevant code snippet related to the "Failed to find %s" error message:

179:	  end
180:	
181:	  if ( mode == "default" ) then
182:	    local f = nmap.fetchfile(DEFAULT_ACCOUNTS)
183:	    if ( not(f) ) then
184:	      return fail(("Failed to find %s"):format(DEFAULT_ACCOUNTS))
185:	    end
186:	
187:	    f = io.open(f)
188:	    if ( not(f) ) then
189:	      return fail(("Failed to open %s"):format(DEFAULT_ACCOUNTS))

Failed to open %s


Here is a relevant code snippet related to the "Failed to open %s" error message:

184:	      return fail(("Failed to find %s"):format(DEFAULT_ACCOUNTS))
185:	    end
186:	
187:	    f = io.open(f)
188:	    if ( not(f) ) then
189:	      return fail(("Failed to open %s"):format(DEFAULT_ACCOUNTS))
190:	    end
191:	
192:	    engine.iterator = brute.Iterators.credential_iterator(f)
193:	  elseif( "accounts" == mode ) then
194:	    engine.iterator = unpwdb.table_iterator(stringaux.strsplit(",%s*", arg_accounts))

Version


This page has been created based on Nmap version 7.92.

Go back to menu.