Nmap svn-brute NSE Script


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

Script Description


The svn-brute.nse script performs brute force password auditing against Subversion source code control servers.

Svn-brute NSE Script Arguments


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

svn-brute.force

Force password guessing when service is accessible both anonymously and through authentication

svn-brute.repo

The Subversion repository 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=svn-brute --script-args svn-brute.force=value,svn-brute.repo=value <target>

Svn-brute NSE Script Example Usage


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

nmap --script svn-brute --script-args svn-brute.repo=/svn/ -p 3690 <host>

Svn-brute NSE Script Example Output


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

PORT     STATE SERVICE REASON
3690/tcp open  svn     syn-ack
| svn-brute:
|   Accounts
|_    patrik:secret => Login correct

Svn-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 svn-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.

Banner reports failure


Here is a relevant code snippet related to the "Banner reports failure" error message:

76:	      return false, result
77:	    end
78:	
79:	    status, msg = self.socket:receive_bytes(1)
80:	    if ( not(status) or not( msg:match("^%( success") ) ) then
81:	      return false, "Banner reports failure"
82:	    end
83:	
84:	    msg = ("( 2 ( edit-pipeline svndiff1 absent-entries depth mergeinfo log-revprops ) %d:%s %d:%s ( ) ) "):format( #repo_url, repo_url, #self.svn_client, self.svn_client )
85:	    status = self.socket:send( msg )
86:	    if ( not(status) ) then

Send failed


Here is a relevant code snippet related to the "Send failed" error message:

82:	    end
83:	
84:	    msg = ("( 2 ( edit-pipeline svndiff1 absent-entries depth mergeinfo log-revprops ) %d:%s %d:%s ( ) ) "):format( #repo_url, repo_url, #self.svn_client, self.svn_client )
85:	    status = self.socket:send( msg )
86:	    if ( not(status) ) then
87:	      return false, "Send failed"
88:	    end
89:	
90:	    status, msg = self.socket:receive_bytes(1)
91:	    if ( not(status) ) then
92:	      return false, "Receive failed"

Receive failed


Here is a relevant code snippet related to the "Receive failed" error message:

87:	      return false, "Send failed"
88:	    end
89:	
90:	    status, msg = self.socket:receive_bytes(1)
91:	    if ( not(status) ) then
92:	      return false, "Receive failed"
93:	    end
94:	
95:	    if ( msg:match("%( success") ) then
96:	      local tmp = msg:match("%( success %( %( ([%S+%s*]-) %)")
97:	      if ( not(tmp) ) then return false, "Failed to detect authentication" end

Failed to detect authentication


Here is a relevant code snippet related to the "Failed to detect authentication" error message:

92:	      return false, "Receive failed"
93:	    end
94:	
95:	    if ( msg:match("%( success") ) then
96:	      local tmp = msg:match("%( success %( %( ([%S+%s*]-) %)")
97:	      if ( not(tmp) ) then return false, "Failed to detect authentication" end
98:	      tmp = stringaux.strsplit(" ", tmp)
99:	      self.auth_mech = {}
100:	      for _, v in pairs(tmp) do self.auth_mech[v] = true end
101:	    elseif ( msg:match("%( failure") ) then
102:	      return false

Failed to read challenge


Here is a relevant code snippet related to the "Failed to read challenge" error message:

125:	      end
126:	
127:	      challenge = msg:match("<.+>")
128:	
129:	      if ( not(challenge) ) then
130:	        return false, "Failed to read challenge"
131:	      end
132:	
133:	      digest = stdnse.tohex(openssl.hmac('md5', password, challenge))
134:	      msg = ("%d:%s %s "):format(#username + 1 + #digest, username, digest)
135:	      self.socket:send( msg )

Username not found


Here is a relevant code snippet related to the "Username not found" error message:

138:	      if ( not(status) ) then
139:	        return false, "error"
140:	      end
141:	
142:	      if ( msg:match("Username not found") ) then
143:	        return false, "Username not found"
144:	      elseif ( msg:match("success") ) then
145:	        return true, "Authentication success"
146:	      else
147:	        return false, "Authentication failed"
148:	      end

Authentication failed


Here is a relevant code snippet related to the "Authentication failed" error message:

142:	      if ( msg:match("Username not found") ) then
143:	        return false, "Username not found"
144:	      elseif ( msg:match("success") ) then
145:	        return true, "Authentication success"
146:	      else
147:	        return false, "Authentication failed"
148:	      end
149:	    else
150:	      return false, "Unsupported auth-mechanism"
151:	    end
152:	

Unsupported auth-mechanism


Here is a relevant code snippet related to the "Unsupported auth-mechanism" error message:

145:	        return true, "Authentication success"
146:	      else
147:	        return false, "Authentication failed"
148:	      end
149:	    else
150:	      return false, "Unsupported auth-mechanism"
151:	    end
152:	
153:	  end,
154:	
155:	  --- Close the SVN connection

Failed to connect to SVN server


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

179:	    local status, msg
180:	
181:	    self.svn = svn:new( self.host, self.port, self.repo )
182:	    status, msg = self.svn:connect()
183:	    if ( not(status) ) then
184:	      local err = brute.Error:new( "Failed to connect to SVN server" )
185:	      -- This might be temporary, set the retry flag
186:	      err:setRetry( true )
187:	      return false, err
188:	    end
189:	

User is invalid


Here is a relevant code snippet related to the "User is invalid" error message:

203:	  --         creds.Account object on success
204:	  login = function( self, username, password )
205:	    local status, msg
206:	
207:	    if ( self.invalid_users[username] ) then
208:	      return false, brute.Error:new( "User is invalid" )
209:	    end
210:	
211:	    status, msg = self.svn:login( username, password )
212:	
213:	    if ( not(status) and msg:match("Username not found") ) then

Username not found


Here is a relevant code snippet related to the "Username not found" error message:

210:	
211:	    status, msg = self.svn:login( username, password )
212:	
213:	    if ( not(status) and msg:match("Username not found") ) then
214:	      self.invalid_users[username] = true
215:	      return false, brute.Error:new("Username not found")
216:	    elseif ( status and msg:match("success") ) then
217:	      return true, creds.Account:new(username, password, creds.State.VALID)
218:	    else
219:	      return false, brute.Error:new( "Incorrect password" )
220:	    end

Incorrect password


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

214:	      self.invalid_users[username] = true
215:	      return false, brute.Error:new("Username not found")
216:	    elseif ( status and msg:match("success") ) then
217:	      return true, creds.Account:new(username, password, creds.State.VALID)
218:	    else
219:	      return false, brute.Error:new( "Incorrect password" )
220:	    end
221:	  end,
222:	
223:	  --- Verifies whether the repository is valid
224:	  --

Failed to connect to SVN repository (%s)


Here is a relevant code snippet related to the "Failed to connect to SVN repository (%s)" error message:

231:	    svn:close()
232:	
233:	    if ( status ) then
234:	      return true
235:	    else
236:	      return false, ("Failed to connect to SVN repository (%s)"):format(self.repo)
237:	    end
238:	  end,
239:	}
240:	
241:	

Version


This page has been created based on Nmap version 7.92.

Go back to menu.