Nmap tso-brute NSE Script
This page contains detailed information about how to use the tso-brute NSE script. For list of all NSE scripts, visit the Nmap NSE Library.
Select: |
---|
Script Overview
Script source code: https://github.com/nmap/nmap/tree/master/scripts/tso-brute.nse
Script categories: intrusive
Target service / protocol: tn3270
Target network port(s): 23, 992, 623
List of CVEs: -
Script Description
TSO account brute forcer.
This script relies on the NSE TN3270 library which emulates a TN3270 screen for NMAP.
TSO user IDs have the following rules:
- it cannot begin with a number
- only contains alpha-numeric characters and @, #, $.
- it cannot be longer than 7 chars
Tso-brute NSE Script Arguments
This is a full list of arguments supported by the tso-brute.nse script:
tso-brute.always_logon
TSO logon can kick a user off if it guesses the correct password. always_logon, when set to true
, will logon, even if the user is logged in (kicking that user off). The default, false
will skip that account.
Commands in a semi-colon separated list needed to access TSO. Defaults to TSO
.
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
passdbThe filename of an alternate password database. Default: nselib/data/passwords.lst
unpwdb.passlimit
The maximum number of passwords passwords
will return (default unlimited).
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.
The maximum number of usernames usernames
will return (default unlimited).
The filename of an alternate username database. Default: nselib/data/usernames.lst
brute.credfileA file containing username and password pairs delimited by '/'
brute.delayThe number of seconds to wait between guesses (default: 0)
brute.emptypassGuess an empty password for each user (default: false)
brute.firstonlyStop guessing after first password is found (default: false)
brute.guessesThe number of guesses to perform against each account. (default: 0 (unlimited)). The argument can be used to prevent account lockouts.
brute.modeCan 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.
Iterate over passwords only for services that provide only a password for authentication. (default: false)
brute.retriesThe number of times to retry if recoverable failures occur. (default: 2)
brute.startThe number of threads the engine will start with. (default: 5).
brute.threadsThe number of initial worker threads, the number of active threads will be automatically adjusted.
brute.uniqueMake sure that each password is only guessed once (default: true)
brute.useraspassGuess 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=tso-brute --script-args tso-brute.always_logon=value,tso-brute.commands=value <target>
Tso-brute NSE Script Example Usage
Here's an example of how to use the tso-brute.nse script:
nmap -p 2401 --script tso-brute <host>
Tso-brute NSE Script Example Output
Here's a sample output from the tso-brute.nse script:
23/tcp open tn3270 syn-ack IBM Telnet TN3270
| tso-brute:
| Node Name:
| IBMUSER:<skipped> - User logged on. Skipped.
| ZERO:<skipped> - User logged on. Skipped.
| COOL:secret - Valid credentials
|_ Statistics: Performed 6 guesses in 6 seconds, average tps: 1
Final times for host: srtt: 96305 rttvar: 72303 to: 385517
Tso-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
- Soldier of Fortran
References
- https://nmap.org/nsedoc/scripts/tso-brute.html
- https://github.com/nmap/nmap/tree/master/scripts/tso-brute.nse
See Also
Related NSE scripts to the tso-brute.nse script:
Visit Nmap NSE Library for more scripts.
The tso-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.
Could not initiate TN3270: %s
Here is a relevant code snippet related to the "Could not initiate TN3270: %s" error message:
80: end,
81: connect = function( self )
82: local status, err = self.tn3270:initiate(self.host,self.port)
83: self.tn3270:get_screen_debug(2)
84: if not status then
85: stdnse.debug("Could not initiate TN3270: %s", err )
86: return false
87: end
88: return true
89: end,
90: disconnect = function( self )
IKJ56710I INVALID USERID
Here is a relevant code snippet related to the "IKJ56710I INVALID USERID" error message:
119: self.tn3270:get_all_data()
120: end
121:
122: if not self.tn3270:find("ENTER USERID")
123: and not self.tn3270:find("TSO/E LOGON")
124: and not self.tn3270:find("IKJ56710I INVALID USERID") then
125: local err = brute.Error:new( "TSO Unavailable" )
126: -- This error occurs on too many concurrent application requests it
127: -- should be temporary. We use the new setReduce function.
128: err:setReduce(true)
129: stdnse.debug(1,"TSO Unavailable for UserID %s", pass )
TSO Unavailable
Here is a relevant code snippet related to the "TSO Unavailable" error message:
120: end
121:
122: if not self.tn3270:find("ENTER USERID")
123: and not self.tn3270:find("TSO/E LOGON")
124: and not self.tn3270:find("IKJ56710I INVALID USERID") then
125: local err = brute.Error:new( "TSO Unavailable" )
126: -- This error occurs on too many concurrent application requests it
127: -- should be temporary. We use the new setReduce function.
128: err:setReduce(true)
129: stdnse.debug(1,"TSO Unavailable for UserID %s", pass )
130: return false, err
Not at TSO
Here is a relevant code snippet related to the "Not at TSO" error message:
143: if not self.tn3270:find('Enter LOGON parameters below') then
144: stdnse.debug(2,"Screen Received for User ID: %s", user)
145: self.tn3270:get_screen_debug(2)
146: -- This error occurs on too many concurrent application requests it
147: -- should be temporary. We use the new setReduce function.
148: local err = brute.Error:new( "Not at TSO" )
149: err:setReduce(true)
150: stdnse.debug(1,"TSO Unavailable for UserID %s", pass )
151: return false, err
152: end
153:
not authorized to use TSO
Here is a relevant code snippet related to the "not authorized to use TSO" error message:
149: err:setReduce(true)
150: stdnse.debug(1,"TSO Unavailable for UserID %s", pass )
151: return false, err
152: end
153:
154: if self.tn3270:find('not authorized to use TSO') then -- invalid user ID
155: stdnse.debug(2,"Got Message: IKJ56420I Userid %s not authorized to use TSO.", user)
156: -- Store the invalid ID in the registry so we don't keep trying it with subsequent passwords
157: -- when using the brute library.
158: register_invalid(user)
159: return false, brute.Error:new( "User ID not authorized to use TSO" )
User ID not authorized to use TSO
Here is a relevant code snippet related to the "User ID not authorized to use TSO" error message:
154: if self.tn3270:find('not authorized to use TSO') then -- invalid user ID
155: stdnse.debug(2,"Got Message: IKJ56420I Userid %s not authorized to use TSO.", user)
156: -- Store the invalid ID in the registry so we don't keep trying it with subsequent passwords
157: -- when using the brute library.
158: register_invalid(user)
159: return false, brute.Error:new( "User ID not authorized to use TSO" )
160: else
161: -- It's a valid account so lets try a password
162: stdnse.debug(2,"%s is a valid TSO User ID. Trying Password: %s", string.upper(user), pass)
163: if always_logon then
164: local writeable = self.tn3270:writeable()
Account Locked out
Here is a relevant code snippet related to the "Account Locked out" error message:
186: -- IKJ56418I CONTACT YOUR TSO ADMINISTRATOR
187: -- The first message (5I) is always followed by the second if the account it revoked
188: -- But not followed by the second message if its just logged on already
189: register_invalid(user) -- We dont want to keep generating errors
190: stdnse.verbose(3,"User: " .. user .. " LOCKED OUT")
191: return false, brute.Error:new("Account Locked out")
192: elseif not (self.tn3270:find("IKJ56421I") or
193: self.tn3270:find("IKJ56443I") or
194: self.tn3270:find("TSS7101E") or
195: self.tn3270:find("TSS714[0-3]E") or
196: self.tn3270:find("TSS7099E") or
Incorrect password
Here is a relevant code snippet related to the "Incorrect password" error message:
211: -- The 'MSG allows testers to discern any relevant messages they may get for the account'
212: stdnse.verbose(2,"Valid User/Pass: " .. user .. "/" .. pass)
213: stdnse.verbose(3,"Valid MSG for " .. user .. "/" .. pass .. ": " .. self.tn3270:get_screen():sub(1,80))
214: return true, creds.Account:new(user, pass, creds.State.VALID)
215: else
216: return false, brute.Error:new( "Incorrect password" )
217: end
218: end
219: end
220: }
221:
Could not initiate TN3270: %s
Here is a relevant code snippet related to the "Could not initiate TN3270: %s" error message:
233: local status, err = tn:initiate(host,port)
234: local tso = false -- initially we're not at TSO logon panel
235: local secprod = "RACF"
236: tn:get_screen_debug(2) -- prints TN3270 screen to debug
237: if not status then
238: stdnse.debug("Could not initiate TN3270: %s", err )
239: return tso, "Could not Initiate TN3270"
240: end
241: local run = stringaux.strsplit(";%s*", commands)
242: for i = 1, #run do
243: stdnse.debug(2,"Issuing Command (#%s of %s): %s", i, #run ,run[i])
Could not Initiate TN3270
Here is a relevant code snippet related to the "Could not Initiate TN3270" error message:
234: local tso = false -- initially we're not at TSO logon panel
235: local secprod = "RACF"
236: tn:get_screen_debug(2) -- prints TN3270 screen to debug
237: if not status then
238: stdnse.debug("Could not initiate TN3270: %s", err )
239: return tso, "Could not Initiate TN3270"
240: end
241: local run = stringaux.strsplit(";%s*", commands)
242: for i = 1, #run do
243: stdnse.debug(2,"Issuing Command (#%s of %s): %s", i, #run ,run[i])
244: tn:send_cursor(run[i])
Enumeration is not possible. PASSWORDPREPROMPT is set to ON.
Here is a relevant code snippet related to the "Enumeration is not possible. PASSWORDPREPROMPT is set to ON." error message:
254: tso = true
255: -- Patch OA44855 removed the ability to enumerate users
256: tn:send_cursor("notreal")
257: tn:get_all_data()
258: if tn:find("IKJ56476I ENTER PASSWORD") then
259: return false, secprod, "Enumeration is not possible. PASSWORDPREPROMPT is set to ON."
260: end
261: end
262: tn:send_pf(3)
263: tn:disconnect()
264: return tso, secprod, "Could not get to TSO. Try --script-args=tso-brute.commands='logon applid(tso)'. Aborting."
Could not get to TSO. Try --script-args=tso-brute.commands='logon applid(tso)'. Aborting.
Here is a relevant code snippet related to the "Could not get to TSO. Try --script-args=tso-brute.commands='logon applid(tso)'. Aborting." error message:
259: return false, secprod, "Enumeration is not possible. PASSWORDPREPROMPT is set to ON."
260: end
261: end
262: tn:send_pf(3)
263: tn:disconnect()
264: return tso, secprod, "Could not get to TSO. Try --script-args=tso-brute.commands='logon applid(tso)'. Aborting."
265: end
266:
267: --- Tests the target to see if we can speed up brute forcing
268: -- VTAM/USSTable will sometimes allow you to put the userid
269: -- in the command area either through data() or just adding
Could not initiate TN3270: %s
Here is a relevant code snippet related to the "Could not initiate TN3270: %s" error message:
280: stdnse.debug2("Connecting TN3270 to %s:%s", host.targetname or host.ip, port.number)
281: local status, err = tn:initiate(host,port)
282: stdnse.debug2("Displaying initial TN3270 Screen:")
283: tn:get_screen_debug(2) -- prints TN3270 screen to debug
284: if not status then
285: stdnse.debug("Could not initiate TN3270: %s", err )
286: return false
287: end
288: -- We're connected now to test.
289: local data = false
290: if commands:upper():find('LOGON APPLID') then
IKJ56710I INVALID USERID
Here is a relevant code snippet related to the "IKJ56710I INVALID USERID" error message:
310: end
311: tn:get_all_data()
312: end
313: tn:get_screen_debug(2)
314:
315: if tn:find("IKJ56710I INVALID USERID") or
316: tn:find("Enter LOGON parameters below") then
317: stdnse.debug('IKJ56700A message skip supported')
318: return true
319: else
320: return false
Version
This page has been created based on Nmap version 7.92.
Go back to menu.