Skip to content

Commit 5296c65

Browse files
author
Brent Cook
committed
Land rapid7#5157, OWA login scanner auth timing logs
2 parents 8aca453 + 1455d4e commit 5296c65

File tree

1 file changed

+15
-7
lines changed

1 file changed

+15
-7
lines changed

modules/auxiliary/scanner/http/owa_login.rb

Lines changed: 15 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,8 @@ def initialize
2727
'SecureState R&D Team',
2828
'sinn3r',
2929
'Brandon Knight',
30-
'Pete (Bokojan) Arzamendi, #Outlook 2013 updates'
30+
'Pete (Bokojan) Arzamendi', # Outlook 2013 updates
31+
'Nate Power' # HTTP timing option
3132
],
3233
'License' => MSF_LICENSE,
3334
'Actions' =>
@@ -81,6 +82,7 @@ def initialize
8182
OptInt.new('RPORT', [ true, "The target port", 443]),
8283
OptAddress.new('RHOST', [ true, "The target address", true]),
8384
OptBool.new('ENUM_DOMAIN', [ true, "Automatically enumerate AD domain using NTLM authentication", true]),
85+
OptBool.new('AUTH_TIME', [ false, "Check HTTP authentication response time", true])
8486
], self.class)
8587

8688

@@ -163,6 +165,10 @@ def try_user_pass(opts)
163165
end
164166

165167
begin
168+
if datastore['AUTH_TIME']
169+
start_time = Time.now
170+
end
171+
166172
res = send_request_cgi({
167173
'encode' => true,
168174
'uri' => auth_path,
@@ -171,6 +177,9 @@ def try_user_pass(opts)
171177
'data' => data
172178
})
173179

180+
if datastore['AUTH_TIME']
181+
elapsed_time = Time.now - start_time
182+
end
174183
rescue ::Rex::ConnectionError, Errno::ECONNREFUSED, Errno::ETIMEDOUT
175184
print_error("#{msg} HTTP Connection Failed, Aborting")
176185
return :abort
@@ -189,7 +198,7 @@ def try_user_pass(opts)
189198
# Check for a response code to make sure login was valid. Changes from 2010 to 2013.
190199
# Check if the password needs to be changed.
191200
if res.headers['location'] =~ /expiredpassword/
192-
print_good("#{msg} SUCCESSFUL LOGIN. '#{user}' : '#{pass}': NOTE password change required")
201+
print_good("#{msg} SUCCESSFUL LOGIN. #{elapsed_time} '#{user}' : '#{pass}': NOTE password change required")
193202
report_hash = {
194203
:host => datastore['RHOST'],
195204
:port => datastore['RPORT'],
@@ -213,7 +222,7 @@ def try_user_pass(opts)
213222
headers['Cookie'] = 'PBack=0;' << res.get_cookies
214223
else
215224
# Login didn't work. no point on going on.
216-
vprint_error("#{msg} FAILED LOGIN. '#{user}' : '#{pass}' (HTTP redirect with reason #{reason})")
225+
vprint_error("#{msg} FAILED LOGIN. #{elapsed_time} '#{user}' : '#{pass}' (HTTP redirect with reason #{reason})")
217226
return :Skip_pass
218227
end
219228
else
@@ -248,12 +257,12 @@ def try_user_pass(opts)
248257
end
249258

250259
if res.redirect?
251-
vprint_error("#{msg} FAILED LOGIN. '#{user}' : '#{pass}' (response was a #{res.code} redirect)")
260+
vprint_error("#{msg} FAILED LOGIN. #{elapsed_time} '#{user}' : '#{pass}' (response was a #{res.code} redirect)")
252261
return :skip_pass
253262
end
254263

255264
if res.body =~ login_check
256-
print_good("#{msg} SUCCESSFUL LOGIN. '#{user}' : '#{pass}'")
265+
print_good("#{msg} SUCCESSFUL LOGIN. #{elapsed_time} '#{user}' : '#{pass}'")
257266

258267
report_hash = {
259268
:host => datastore['RHOST'],
@@ -267,7 +276,7 @@ def try_user_pass(opts)
267276
report_auth_info(report_hash)
268277
return :next_user
269278
else
270-
vprint_error("#{msg} FAILED LOGIN. '#{user}' : '#{pass}' (response body did not match)")
279+
vprint_error("#{msg} FAILED LOGIN. #{elapsed_time} '#{user}' : '#{pass}' (response body did not match)")
271280
return :skip_pass
272281
end
273282
end
@@ -318,4 +327,3 @@ def msg
318327
end
319328

320329
end
321-

0 commit comments

Comments
 (0)