Skip to content

Commit ba9ce3f

Browse files
committed
Land rapid7#7665, Add ABORT_ON_LOCKOUT option for smb_login
2 parents 657fadb + d3a8409 commit ba9ce3f

File tree

2 files changed

+6
-0
lines changed

2 files changed

+6
-0
lines changed

lib/metasploit/framework/login_scanner/smb.rb

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -203,6 +203,8 @@ def attempt_login(credential)
203203
status = case e.get_error(e.error_code)
204204
when *StatusCodes::CORRECT_CREDENTIAL_STATUS_CODES
205205
Metasploit::Model::Login::Status::DENIED_ACCESS
206+
when 'STATUS_ACCOUNT_LOCKED_OUT'
207+
Metasploit::Model::Login::Status::LOCKED_OUT
206208
when 'STATUS_LOGON_FAILURE', 'STATUS_ACCESS_DENIED'
207209
Metasploit::Model::Login::Status::INCORRECT
208210
else

modules/auxiliary/scanner/smb/smb_login.rb

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,7 @@ def initialize
5555
register_options(
5656
[
5757
Opt::Proxies,
58+
OptBool.new('ABORT_ON_LOCKOUT', [ true, "Abort the run when an account lockout is detected", true ]),
5859
OptBool.new('PRESERVE_DOMAINS', [ false, "Respect a username that contains a domain name.", true ]),
5960
OptBool.new('RECORD_GUEST', [ false, "Record guest-privileged random logins to the database", false ]),
6061
OptBool.new('DETECT_ANY_AUTH', [false, 'Enable detection of systems accepting any authentication', true])
@@ -121,6 +122,9 @@ def run_host(ip)
121122

122123
@scanner.scan! do |result|
123124
case result.status
125+
when Metasploit::Model::Login::Status::LOCKED_OUT
126+
print_error("Account lockout detected on '#{result.credential}'")
127+
return if datastore['ABORT_ON_LOCKOUT']
124128
when Metasploit::Model::Login::Status::DENIED_ACCESS
125129
print_brute :level => :status, :ip => ip, :msg => "Correct credentials, but unable to login: '#{result.credential}', #{result.proof}"
126130
report_creds(ip, rport, result)

0 commit comments

Comments
 (0)