Nmap cics-user-brute NSE Script
This page contains detailed information about how to use the cics-user-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/cics-user-brute.nse
Script categories: intrusive, brute
Target service / protocol: tn3270
Target network port(s): 23, 992
List of CVEs: -
Script Description
CICS User ID brute forcing script for the CESL login screen.
Cics-user-brute NSE Script Arguments
This is a full list of arguments supported by the cics-user-brute.nse script:
cics-user-brute.commands
Commands in a semi-colon separated list needed to access CICS. Defaults to CICS
.
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=cics-user-brute --script-args cics-user-brute.commands=value,creds.global=value <target>
Cics-user-brute NSE Script Example Usage
Here's an example of how to use the cics-user-brute.nse script:
nmap --script=cics-user-brute -p 23 <targets>
nmap --script=cics-user-brute --script-args userdb=users.txt,
cics-user-brute.commands="exit;logon applid(cics42)" -p 23 <targets>
Cics-user-brute NSE Script Example Output
Here's a sample output from the cics-user-brute.nse script:
PORT STATE SERVICE
23/tcp open tn3270
| cics-user-brute:
| Accounts:
| PLAGUE: Valid - CICS User ID
|_ Statistics: Performed 31 guesses in 114 seconds, average tps: 0
Cics-user-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
- Philip Young aka Soldier of Fortran
References
- https://nmap.org/nsedoc/scripts/cics-user-brute.html
- https://github.com/nmap/nmap/tree/master/scripts/cics-user-brute.nse
See Also
Related NSE scripts to the cics-user-brute.nse script:
Visit Nmap NSE Library for more scripts.
The cics-user-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:
66: end,
67: connect = function( self )
68: local status, err = self.tn3270:initiate(self.host,self.port)
69: self.tn3270:get_screen_debug(2)
70: if not status then
71: stdnse.debug("Could not initiate TN3270: %s", err )
72: return false
73: end
74: stdnse.debug(2,"Connect Successful")
75: return true
76: end,
Can't get to CESL
Here is a relevant code snippet related to the "Can't get to CESL" error message:
113: self.tn3270:get_screen_debug(2)
114: end
115: -- At this point we MUST be at CESL to try accounts.
116: -- If we're not then we quit with an error
117: if not (self.tn3270:find('SIGN ON TO CICS') or self.tn3270:find("Signon to CICS")) then
118: local err = brute.Error:new( "Can't get to CESL")
119: err:setRetry( true )
120: return false, err
121: end
122:
123: -- Ok we're good we're at CESL. Send the Userid and Password.
Error with UserID entry
Here is a relevant code snippet related to the "Error with UserID entry" error message:
140: self.tn3270:get_screen_debug(2)
141: loop = loop + 1 -- We don't want this to loop forever
142: end
143:
144: if loop == 300 then
145: local err = brute.Error:new( "Error with UserID entry")
146: err:setRetry( true )
147: return false, err
148: end
149:
150: -- Now check what we received if its valid or not
Incorrect password
Here is a relevant code snippet related to the "Incorrect password" error message:
153: self.tn3270:find('DFHCE3532') then
154: -- Top Secret:
155: -- TSS7101E Password is Incorrect
156: -- RACF:
157: -- DFHCE3530/2 Your userid or password is invalid. Please retype both.
158: return false, brute.Error:new( "Incorrect password" )
159: elseif self.tn3270:find('TSS7145E') or
160: self.tn3270:find("TSS714[0-3]E") or
161: self.tn3270:find('TSS7160E') or
162: self.tn3270:find('TSS7120E') then
163: -- Top Secret:
User ID Not Able to Use CICS
Here is a relevant code snippet related to the "User ID Not Able to Use CICS" error message:
169: -- TSS7145E ACCESSOR ID <acid> NOT DEFINED TO SECURITY
170: -- TSS7160E Facility <X> Not Authorized for Your Use
171: -- Store the invalid ID in the registry so we don't keep trying it with subsequent passwords
172: -- when using default brute library.
173: register_invalid(user)
174: return false, brute.Error:new( "User ID Not Able to Use CICS" )
175: elseif self.tn3270:find("DFHCE3549") or
176: self.tn3270:find('TSS7000I') or
177: self.tn3270:find('TSS7110E Password Has Expired. New Password Missing') or
178: self.tn3270:find('TSS7001I') then
179: stdnse.verbose("Valid CICS UserID / Password: " .. user .. "/" .. pass)
Incorrect password
Here is a relevant code snippet related to the "Incorrect password" error message:
179: stdnse.verbose("Valid CICS UserID / Password: " .. user .. "/" .. pass)
180: return true, creds.Account:new(user, pass, creds.State.VALID)
181: else
182: -- ok whoa, something happened, print the screen but don't store as valid
183: stdnse.verbose("Valid(?) user/pass with current output " .. user .. "/" .. pass .. "\n" .. self.tn3270:get_screen())
184: return false, brute.Error:new( "Incorrect password" )
185: end
186: return false, brute.Error:new("Something went wrong, we didn't get a proper response")
187: end
188: }
189:
Something went wrong, we didn't get a proper response
Here is a relevant code snippet related to the "Something went wrong, we didn't get a proper response" error message:
181: else
182: -- ok whoa, something happened, print the screen but don't store as valid
183: stdnse.verbose("Valid(?) user/pass with current output " .. user .. "/" .. pass .. "\n" .. self.tn3270:get_screen())
184: return false, brute.Error:new( "Incorrect password" )
185: end
186: return false, brute.Error:new("Something went wrong, we didn't get a proper response")
187: end
188: }
189:
190: --- Tests the target to see if we can even get to CICS
191: --
Could not initiate TN3270: %s
Here is a relevant code snippet related to the "Could not initiate TN3270: %s" error message:
199: local tn = tn3270.Telnet:new()
200: tn:disable_tn3270e()
201: local status, err = tn:initiate(host,port)
202: local cesl = false -- initially we're not at CICS
203: if not status then
204: stdnse.debug("Could not initiate TN3270: %s", err )
205: return false
206: end
207: tn:get_screen_debug(2) -- prints TN3270 screen to debug
208: stdnse.debug(2,"Getting to CICS")
209: local run = stringaux.strsplit(";%s*", commands)
Could not get to CICS after 5 attempts. Is this even CICS?
Here is a relevant code snippet related to the "Could not get to CICS after 5 attempts. Is this even CICS?" error message:
242: tn:get_all_data()
243: tn:get_screen_debug(2)
244: count = count + 1
245: end
246: if count == 5 then
247: return false, 'Could not get to CICS after 5 attempts. Is this even CICS?'
248: end
249: stdnse.debug(2,"Sending 'CESL'")
250: tn:send_cursor('CESL')
251: tn:get_all_data()
252: if tn:isClear() then
Could not get to CESL (CICS Logon Screen)
Here is a relevant code snippet related to the "Could not get to CESL (CICS Logon Screen)" error message:
258: stdnse.verbose(2,"At CICS Login Transaction (CESL)")
259: tn:disconnect()
260: return true
261: end
262: tn:disconnect()
263: return false, 'Could not get to CESL (CICS Logon Screen)'
264: end
265:
266: -- Filter iterator for unpwdb
267: -- IDs are limited to 8 alpha numeric and @, #, $ and can't start with a number
268: -- pattern:
Version
This page has been created based on Nmap version 7.92.
Go back to menu.