Nmap rlogin-brute NSE Script


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

Script Description


The rlogin-brute.nse script performs brute force password auditing against the classic UNIX rlogin (remote login) service. This script must be run in privileged mode on UNIX because it must bind to a low source port number.

Rlogin-brute NSE Script Arguments


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

rlogin-brute.timeout

Socket timeout for connecting to rlogin (default 10s)

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=rlogin-brute --script-args rlogin-brute.timeout=value,creds.global=value <target>

Rlogin-brute NSE Script Example Usage


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

nmap -p 513 --script rlogin-brute <ip>

Rlogin-brute NSE Script Example Output


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

PORT    STATE SERVICE
513/tcp open  login
| rlogin-brute:
|   Accounts
|     nmap:test - Valid credentials
|   Statistics
|_    Performed 4 guesses in 5 seconds, average tps: 0

Rlogin-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


Visit Nmap NSE Library for more scripts.

The rlogin-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.

failed to retrieve socket status


Here is a relevant code snippet related to the "failed to retrieve socket status" error message:

70:	
71:	    if ( status ) then
72:	      local lport, _
73:	      status, _, lport = self.socket:get_info()
74:	      if (not(status) ) then
75:	        return false, "failed to retrieve socket status"
76:	      end
77:	    else
78:	      self.socket:close()
79:	    end
80:	    if ( not(status) ) then

ERROR: failed to connect to server


Here is a relevant code snippet related to the "ERROR: failed to connect to server" error message:

76:	      end
77:	    else
78:	      self.socket:close()
79:	    end
80:	    if ( not(status) ) then
81:	      stdnse.debug3("ERROR: failed to connect to server")
82:	    end
83:	    return status
84:	  end,
85:	
86:	  login = function(self, username, password)

Failed to read response from server


Here is a relevant code snippet related to the "Failed to read response from server" error message:

87:	    local data = ("\0%s\0%s\0vt100/9600\0"):format(username, username)
88:	    local status, err = self.socket:send(data)
89:	
90:	    status, data = self.socket:receive()
91:	    if (not(status)) then
92:	      local err = brute.Error:new("Failed to read response from server")
93:	      err:setRetry( true )
94:	      return false, err
95:	    end
96:	    if ( data ~= "\0" ) then
97:	      stdnse.debug2("ERROR: Expected null byte")

ERROR: Expected null byte


Here is a relevant code snippet related to the "ERROR: Expected null byte" error message:

92:	      local err = brute.Error:new("Failed to read response from server")
93:	      err:setRetry( true )
94:	      return false, err
95:	    end
96:	    if ( data ~= "\0" ) then
97:	      stdnse.debug2("ERROR: Expected null byte")
98:	      local err = brute.Error:new( "Expected null byte" )
99:	      err:setRetry( true )
100:	      return false, err
101:	    end
102:	

Expected null byte


Here is a relevant code snippet related to the "Expected null byte" error message:

93:	      err:setRetry( true )
94:	      return false, err
95:	    end
96:	    if ( data ~= "\0" ) then
97:	      stdnse.debug2("ERROR: Expected null byte")
98:	      local err = brute.Error:new( "Expected null byte" )
99:	      err:setRetry( true )
100:	      return false, err
101:	    end
102:	
103:	    status, data = self.socket:receive()

Failed to read response from server


Here is a relevant code snippet related to the "Failed to read response from server" error message:

100:	      return false, err
101:	    end
102:	
103:	    status, data = self.socket:receive()
104:	    if (not(status)) then
105:	      local err = brute.Error:new("Failed to read response from server")
106:	      err:setRetry( true )
107:	      return false, err
108:	    end
109:	    if ( data ~= "Password: " ) then
110:	      stdnse.debug2("ERROR: Expected password prompt")

ERROR: Expected password prompt


Here is a relevant code snippet related to the "ERROR: Expected password prompt" error message:

105:	      local err = brute.Error:new("Failed to read response from server")
106:	      err:setRetry( true )
107:	      return false, err
108:	    end
109:	    if ( data ~= "Password: " ) then
110:	      stdnse.debug2("ERROR: Expected password prompt")
111:	      local err = brute.Error:new( "Expected password prompt" )
112:	      err:setRetry( true )
113:	      return false, err
114:	    end
115:	

Expected password prompt


Here is a relevant code snippet related to the "Expected password prompt" error message:

106:	      err:setRetry( true )
107:	      return false, err
108:	    end
109:	    if ( data ~= "Password: " ) then
110:	      stdnse.debug2("ERROR: Expected password prompt")
111:	      local err = brute.Error:new( "Expected password prompt" )
112:	      err:setRetry( true )
113:	      return false, err
114:	    end
115:	
116:	    status, err = self.socket:send(password .. "\r")

Failed to read response from server


Here is a relevant code snippet related to the "Failed to read response from server" error message:

114:	    end
115:	
116:	    status, err = self.socket:send(password .. "\r")
117:	    status, data = self.socket:receive()
118:	    if (not(status)) then
119:	      local err = brute.Error:new("Failed to read response from server")
120:	      err:setRetry( true )
121:	      return false, err
122:	    end
123:	
124:	    status, data = self.socket:receive()

Failed to read response from server


Here is a relevant code snippet related to the "Failed to read response from server" error message:

121:	      return false, err
122:	    end
123:	
124:	    status, data = self.socket:receive()
125:	    if (not(status)) then
126:	      local err = brute.Error:new("Failed to read response from server")
127:	      err:setRetry( true )
128:	      return false, err
129:	    end
130:	
131:	    if ( data:match("[Pp]assword") or data:match("[Ii]ncorrect") ) then

Incorrect password


Here is a relevant code snippet related to the "Incorrect password" error message:

127:	      err:setRetry( true )
128:	      return false, err
129:	    end
130:	
131:	    if ( data:match("[Pp]assword") or data:match("[Ii]ncorrect") ) then
132:	      return false, brute.Error:new( "Incorrect password" )
133:	    end
134:	
135:	    return true, creds.Account:new(username, password, creds.State.VALID)
136:	  end,
137:	

rlogin-brute needs Nmap to be run in privileged mode


Here is a relevant code snippet related to the "rlogin-brute needs Nmap to be run in privileged mode" error message:

145:	
146:	action = function(host, port)
147:	
148:	  if ( not(nmap.is_privileged()) ) then
149:	    stdnse.verbose1("Script must be run in privileged mode. Skipping.")
150:	    return stdnse.format_output(false, "rlogin-brute needs Nmap to be run in privileged mode")
151:	  end
152:	
153:	  local options = {
154:	    timeout = arg_timeout
155:	  }

Version


This page has been created based on Nmap version 7.92.

Go back to menu.