Skip to content

Commit f74fd9e

Browse files
committed
Land rapid7#7672, support LOCKED_OUT and DISABLED login status
2 parents 378d8ae + 7e0b224 commit f74fd9e

File tree

2 files changed

+21
-3
lines changed

2 files changed

+21
-3
lines changed

lib/metasploit/framework/login_scanner/base.rb

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -199,6 +199,7 @@ def scan!
199199
total_error_count = 0
200200

201201
successful_users = Set.new
202+
ignored_users = Set.new
202203
first_attempt = true
203204

204205
each_credential do |credential|
@@ -213,6 +214,14 @@ def scan!
213214
next
214215
end
215216

217+
# Users that went into the lock-out list
218+
if ignored_users.include?(credential.public)
219+
if credential.parent.respond_to?(:skipped)
220+
credential.parent.skipped = true
221+
end
222+
next
223+
end
224+
216225
if first_attempt
217226
first_attempt = false
218227
else
@@ -228,6 +237,10 @@ def scan!
228237
consecutive_error_count = 0
229238
successful_users << credential.public
230239
break if stop_on_success
240+
elsif result.status == Metasploit::Model::Login::Status::LOCKED_OUT
241+
ignored_users << credential.public
242+
elsif result.status == Metasploit::Model::Login::Status::DISABLED
243+
ignored_users << credential.public
231244
else
232245
if result.status == Metasploit::Model::Login::Status::UNABLE_TO_CONNECT
233246
consecutive_error_count += 1

modules/auxiliary/scanner/smb/smb_login.rb

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -55,7 +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 ]),
58+
OptBool.new('ABORT_ON_LOCKOUT', [ true, "Abort the run when an account lockout is detected", false ]),
5959
OptBool.new('PRESERVE_DOMAINS', [ false, "Respect a username that contains a domain name.", true ]),
6060
OptBool.new('RECORD_GUEST', [ false, "Record guest-privileged random logins to the database", false ]),
6161
OptBool.new('DETECT_ANY_AUTH', [false, 'Enable detection of systems accepting any authentication', true])
@@ -123,8 +123,13 @@ def run_host(ip)
123123
@scanner.scan! do |result|
124124
case result.status
125125
when Metasploit::Model::Login::Status::LOCKED_OUT
126-
print_error("Account lockout detected on '#{result.credential}'")
127-
return if datastore['ABORT_ON_LOCKOUT']
126+
if datastore['ABORT_ON_LOCKOUT']
127+
print_error("Account lockout detected on '#{result.credential.public}', aborting.")
128+
return
129+
else
130+
print_error("Account lockout detected on '#{result.credential.public}', skipping this user.")
131+
end
132+
128133
when Metasploit::Model::Login::Status::DENIED_ACCESS
129134
print_brute :level => :status, :ip => ip, :msg => "Correct credentials, but unable to login: '#{result.credential}', #{result.proof}"
130135
report_creds(ip, rport, result)

0 commit comments

Comments
 (0)