Nmap oracle-brute NSE Script


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

Script Description


The oracle-brute.nse script performs brute force password auditing against Oracle servers.

Running it in default mode it performs an audit against a list of common Oracle usernames and passwords. The mode can be changed by supplying the argument oracle-brute.nodefault at which point the script will use the username- and password- lists supplied with Nmap. Custom username- and password- lists may be supplied using the userdb and passdb arguments. The default credential list can be changed too by using the brute.credfile argument. In case the userdb or passdb arguments are supplied, the script assumes that it should run in the nodefault mode.

In modern versions of Oracle password guessing speeds decrease after a few guesses and remain slow, due to connection throttling.

WARNING: The script makes no attempt to discover the amount of guesses that can be made before locking an account. Running this script may therefor result in a large number of accounts being locked out on the database server.

Oracle-brute NSE Script Arguments


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

oracle-brute.nodefault

Do not attempt to guess any Oracle default accounts

oracle-brute.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 --script-args oracle-brute.nodefault=value,oracle-brute.sid=value <target>

Oracle-brute NSE Script Example Usage


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

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

Oracle-brute NSE Script Example Output


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

PORT     STATE  SERVICE REASON
1521/tcp open  oracle  syn-ack
| oracle-brute:
|   Accounts
|     system:powell => Account locked
|     haxxor:haxxor => Valid credentials
|   Statistics
|_    Perfomed 157 guesses in 8 seconds, average tps: 19

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


  • Patrik Karlsson

References


See Also


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

Visit Nmap NSE Library for more scripts.

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

111:	      if ( tries < MAX_RETRIES ) then
112:	        stdnse.debug2("Attempting to re-connect (attempt %d of %d)", MAX_RETRIES - tries, MAX_RETRIES)
113:	      end
114:	      status, data = self.helper:Connect()
115:	      if ( not(status) ) then
116:	        stdnse.debug2("ERROR: An Oracle %s error occurred", data)
117:	        self.helper:Close()
118:	      else
119:	        break
120:	      end
121:	      tries = tries - 1

Account already discovered


Here is a relevant code snippet related to the "Account already discovered" error message:

138:	  --         creds.Account object on success
139:	  login = function( self, username, password )
140:	    local status, data = self.helper:Login( username, password )
141:	
142:	    if ( sysdba[username] ) then
143:	      return false, brute.Error:new("Account already discovered")
144:	    end
145:	
146:	    if ( status ) then
147:	      self.helper:Close()
148:	      ConnectionPool[coroutine.running()] = nil

username: %s, password: %s, error: %s


Here is a relevant code snippet related to the "username: %s, password: %s, error: %s" error message:

154:	    elseif ( data:match("ORA[-]28009") ) then
155:	      sysdba[username] = true
156:	      return true, creds.Account:new(username .. " as sysdba", password, creds.State.VALID)
157:	    -- check for any other message
158:	    elseif ( data:match("ORA[-]%d+")) then
159:	      stdnse.debug3("username: %s, password: %s, error: %s", username, password, data )
160:	      return false, brute.Error:new(data)
161:	    -- any other errors are likely communication related, attempt to re-try
162:	    else
163:	      self.helper:Close()
164:	      ConnectionPool[coroutine.running()] = nil

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


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

186:	    stdnse.get_script_args('tns.sid')
187:	  local engine = brute.Engine:new(Driver, host, port, sid)
188:	  local mode = "default"
189:	
190:	  if ( not(sid) ) then
191:	    return fail("Oracle instance not set (see oracle-brute.sid or tns.sid)")
192:	  end
193:	
194:	  local helper = tns.Helper:new( host, port, sid )
195:	  local status, result = helper:Connect()
196:	  if ( not(status) ) then

Failed to connect to oracle server


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

192:	  end
193:	
194:	  local helper = tns.Helper:new( host, port, sid )
195:	  local status, result = helper:Connect()
196:	  if ( not(status) ) then
197:	    return fail("Failed to connect to oracle server")
198:	  end
199:	  helper:Close()
200:	
201:	  local f
202:	

Failed to find %s


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

208:	  end
209:	
210:	  if ( mode == "default" ) then
211:	    f = nmap.fetchfile(DEFAULT_ACCOUNTS)
212:	    if ( not(f) ) then
213:	      return fail(("Failed to find %s"):format(DEFAULT_ACCOUNTS))
214:	    end
215:	
216:	    f = io.open(f)
217:	    if ( not(f) ) then
218:	      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:

213:	      return fail(("Failed to find %s"):format(DEFAULT_ACCOUNTS))
214:	    end
215:	
216:	    f = io.open(f)
217:	    if ( not(f) ) then
218:	      return fail(("Failed to open %s"):format(DEFAULT_ACCOUNTS))
219:	    end
220:	
221:	    engine.iterator = brute.Iterators.credential_iterator(f)
222:	  end
223:	

Version


This page has been created based on Nmap version 7.92.

Go back to menu.