Skip to content

Commit 9bcc988

Browse files
Nate Powerwvu
authored andcommitted
Update owa_login
1 parent 7886ac6 commit 9bcc988

File tree

1 file changed

+17
-10
lines changed

1 file changed

+17
-10
lines changed

modules/auxiliary/scanner/http/owa_login.rb

Lines changed: 17 additions & 10 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, "Time HTTP authentication response(in seconds)", true]),
8486
], self.class)
8587

8688

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

165167
begin
168+
start_time = Time.now
166169
res = send_request_cgi({
167170
'encode' => true,
168171
'uri' => auth_path,
@@ -171,6 +174,10 @@ def try_user_pass(opts)
171174
'data' => data
172175
})
173176

177+
if (datastore['AUTH_TIME'].to_s.match(/^(t|y|1)/i))
178+
elapsed_time = Time.now - start_time
179+
end
180+
174181
rescue ::Rex::ConnectionError, Errno::ECONNREFUSED, Errno::ETIMEDOUT
175182
print_error("#{msg} HTTP Connection Failed, Aborting")
176183
return :abort
@@ -186,10 +193,10 @@ def try_user_pass(opts)
186193
return :abort
187194
end
188195
if action.name == "OWA_2013"
189-
# Check for a response code to make sure login was valid. Changes from 2010 to 2013.
190-
# Check if the password needs to be changed.
196+
#Check for a response code to make sure login was valid. Changes from 2010 to 2013.
197+
#Check if the password needs to be changed.
191198
if res.headers['location'] =~ /expiredpassword/
192-
print_good("#{msg} SUCCESSFUL LOGIN. '#{user}' : '#{pass}': NOTE password change required")
199+
print_good("#{msg} SUCCESSFUL LOGIN. #{elapsed_time} '#{user}' : '#{pass}': NOTE password change required")
193200
report_hash = {
194201
:host => datastore['RHOST'],
195202
:port => datastore['RPORT'],
@@ -203,7 +210,7 @@ def try_user_pass(opts)
203210
return :next_user
204211
end
205212

206-
# No password change required moving on.
213+
#No password change required moving on.
207214
unless location = res.headers['location']
208215
print_error("#{msg} No HTTP redirect. This is not OWA 2013, aborting.")
209216
return :abort
@@ -212,8 +219,8 @@ def try_user_pass(opts)
212219
if reason == nil
213220
headers['Cookie'] = 'PBack=0;' << res.get_cookies
214221
else
215-
# Login didn't work. no point on going on.
216-
vprint_error("#{msg} FAILED LOGIN. '#{user}' : '#{pass}' (HTTP redirect with reason #{reason})")
222+
#Login didn't work. no point on going on.
223+
vprint_error("#{msg} FAILED LOGIN. #{elapsed_time} '#{user}' : '#{pass}' (HTTP redirect with reason #{reason})")
217224
return :Skip_pass
218225
end
219226
else
@@ -248,12 +255,12 @@ def try_user_pass(opts)
248255
end
249256

250257
if res.redirect?
251-
vprint_error("#{msg} FAILED LOGIN. '#{user}' : '#{pass}' (response was a #{res.code} redirect)")
258+
vprint_error("#{msg} FAILED LOGIN. #{elapsed_time} '#{user}' : '#{pass}' (response was a #{res.code} redirect)")
252259
return :skip_pass
253260
end
254261

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

258265
report_hash = {
259266
:host => datastore['RHOST'],
@@ -267,7 +274,7 @@ def try_user_pass(opts)
267274
report_auth_info(report_hash)
268275
return :next_user
269276
else
270-
vprint_error("#{msg} FAILED LOGIN. '#{user}' : '#{pass}' (response body did not match)")
277+
vprint_error("#{msg} FAILED LOGIN. #{elapsed_time} '#{user}' : '#{pass}' (response body did not match)")
271278
return :skip_pass
272279
end
273280
end

0 commit comments

Comments
 (0)