Skip to content

Commit 53ab2ae

Browse files
committed
Land rapid7#3386, a few datastore msftidy error fixes
2 parents 325e75b + 1aee0f3 commit 53ab2ae

File tree

4 files changed

+16
-47
lines changed

4 files changed

+16
-47
lines changed

modules/auxiliary/scanner/http/http_traversal.rb

Lines changed: 10 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -106,7 +106,7 @@ def fuzz
106106
1.upto(depth) do |d|
107107
file_to_read.each do |f|
108108
trigger = base * d
109-
p = datastore['PATH'] + trigger + f
109+
p = normalize_uri(datastore['PATH']) + trigger + f
110110
req = ini_request(p)
111111
vprint_status("Trying: http://#{rhost}:#{rport}#{p}")
112112
res = send_request_cgi(req, 25)
@@ -187,15 +187,15 @@ def check(trigger)
187187
if datastore['TRIGGER'].empty?
188188
# Found trigger using fuzz()
189189
found = true if trigger
190-
uri = datastore['PATH'] + trigger
190+
uri = normalize_uri(datastore['PATH']) + trigger
191191
else
192192
# Manual check. meh.
193193
if datastore['FILE'].empty?
194194
print_error("Must specify a 'FILE' to check manually")
195195
return
196196
end
197197

198-
uri = datastore['PATH'] + trigger + datastore['FILE']
198+
uri = normalize_uri(datastore['PATH']) + trigger + datastore['FILE']
199199
req = ini_request(uri)
200200
vprint_status("Trying: http://#{rhost}:#{rport}#{uri}")
201201
res = send_request_cgi(req, 25)
@@ -211,7 +211,7 @@ def check(trigger)
211211
:port => rport,
212212
:vhost => datastore['VHOST'],
213213
:path => uri,
214-
:params => datastore['PATH'],
214+
:params => normalize_uri(datastore['PATH']),
215215
:pname => trigger,
216216
:risk => 3,
217217
:proof => trigger,
@@ -234,7 +234,7 @@ def lfi_download(trigger, files)
234234
# Our trigger already puts us in '/', so our filename doesn't need to begin with that
235235
f = f[1,f.length] if f =~ /^\//
236236

237-
req = ini_request(uri = (datastore['PATH'] + trigger + f).chop)
237+
req = ini_request(uri = (normalize_uri(datastore['PATH']) + trigger + f).chop)
238238
res = send_request_cgi(req, 25)
239239

240240
vprint_status("#{res.code.to_s} for http://#{rhost}:#{rport}#{uri}") if res
@@ -261,7 +261,7 @@ def php_download(files)
261261
# Our trigger already puts us in '/', so our filename doesn't need to begin with that
262262
f = f[1,f.length] if f =~ /^\//
263263

264-
req = ini_request(uri = (datastore['PATH'] + "php://filter/read=convert.base64-encode/resource=" + f).chop)
264+
req = ini_request(uri = (normalize_uri(datastore['PATH']) + "php://filter/read=convert.base64-encode/resource=" + f).chop)
265265
res = send_request_cgi(req, 25)
266266

267267
vprint_status("#{res.code.to_s} for http://#{rhost}:#{rport}#{uri}") if res
@@ -294,7 +294,7 @@ def is_writable(trigger)
294294

295295
# Form the PUT request
296296
fname = Rex::Text.rand_text_alpha(rand(5) + 5) + '.txt'
297-
uri = datastore['PATH'] + trigger + fname
297+
uri = normalize_uri(datastore['PATH']) + trigger + fname
298298
vprint_status("Attempt to upload to: http://#{rhost}:#{rport}#{uri}")
299299
req = ini_request(uri)
300300

@@ -331,14 +331,10 @@ def load_filelist
331331
end
332332

333333
def run_host(ip)
334-
# Make sure datastore['PATH] begins with a '/'
335-
if datastore['PATH'] !~ /^\//
336-
datastore['PATH'] = '/' + datastore['PATH']
334+
# Warn if it's not a well-formed UPPERCASE method
335+
if datastore['METHOD'] !~ /^[A-Z]+$/
336+
print_warning("HTTP method #{datastore['METHOD']} is not Apache-compliant. Try only UPPERCASE letters.")
337337
end
338-
339-
# Some webservers (ie. Apache) might not like the HTTP method to be lower-case
340-
datastore['METHOD'] = datastore['METHOD'].upcase
341-
342338
print_status("Running action: #{action.name}...")
343339

344340
# And it's..... "SHOW TIME!!"

modules/auxiliary/scanner/http/owa_login.rb

Lines changed: 0 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -93,26 +93,7 @@ def initialize
9393
deregister_options('BLANK_PASSWORDS', 'RHOSTS','PASSWORD','USERNAME')
9494
end
9595

96-
def cleanup
97-
# Restore the original settings
98-
datastore['BLANK_PASSWORDS'] = @blank_passwords_setting
99-
datastore['USER_AS_PASS'] = @user_as_pass_setting
100-
end
101-
10296
def run
103-
# Store the original setting
104-
@blank_passwords_setting = datastore['BLANK_PASSWORDS']
105-
106-
# OWA doesn't support blank passwords or usernames!
107-
datastore['BLANK_PASSWORDS'] = false
108-
109-
# If there's a pre-defined username/password, we need to turn off USER_AS_PASS
110-
# so that the module won't just try username:username, and then exit.
111-
@user_as_pass_setting = datastore['USER_AS_PASS']
112-
if not datastore['USERNAME'].nil? and not datastore['PASSWORD'].nil?
113-
print_status("Disabling 'USER_AS_PASS' because you've specified an username/password")
114-
datastore['USER_AS_PASS'] = false
115-
end
11697

11798
vhost = datastore['VHOST'] || datastore['RHOST']
11899

modules/auxiliary/scanner/oracle/xdb_sid_brute.rb

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,6 @@ def initialize
3232
OptString.new('CSVFILE', [ false, 'The file that contains a list of default accounts.', File.join(Msf::Config.install_root, 'data', 'wordlists', 'oracle_default_passwords.csv')]),
3333
Opt::RPORT(8080),
3434
], self.class)
35-
deregister_options('DBUSER','DBPASS')
3635
end
3736

3837
def run_host(ip)
@@ -57,9 +56,9 @@ def run_host(ip)
5756

5857
fd = CSV.foreach(list) do |brute|
5958

60-
datastore['DBUSER'] = brute[2].downcase
61-
datastore['DBPASS'] = brute[3].downcase
62-
user_pass = "#{datastore['DBUSER']}:#{datastore['DBPASS']}"
59+
dbuser = brute[2].downcase
60+
dbpass = brute[3].downcase
61+
user_pass = "#{dbuser}:#{dbpass}"
6362

6463
res = send_request_raw({
6564
'uri' => '/oradb/PUBLIC/GLOBAL_NAME',
@@ -72,7 +71,7 @@ def run_host(ip)
7271
}, 10)
7372

7473
if( not res )
75-
vprint_error("Unable to retrieve SID for #{ip}:#{datastore['RPORT']} with #{datastore['DBUSER']} / #{datastore['DBPASS']}...")
74+
vprint_error("Unable to retrieve SID for #{ip}:#{datastore['RPORT']} with #{dbuser} / #{dbpass}...")
7675
next
7776
end
7877
if (res.code == 200)
@@ -89,10 +88,10 @@ def run_host(ip)
8988
:data => sid,
9089
:update => :unique_data
9190
)
92-
print_good("Discovered SID: '#{sid[0]}' for host #{ip}:#{datastore['RPORT']} with #{datastore['DBUSER']} / #{datastore['DBPASS']}")
91+
print_good("Discovered SID: '#{sid[0]}' for host #{ip}:#{datastore['RPORT']} with #{dbuser} / #{dbpass}")
9392
users.push(user_pass)
9493
else
95-
vprint_error("Unable to retrieve SID for #{ip}:#{datastore['RPORT']} with #{datastore['DBUSER']} / #{datastore['DBPASS']}...")
94+
vprint_error("Unable to retrieve SID for #{ip}:#{datastore['RPORT']} with #{dbuser} / #{dbpass}...")
9695
end
9796
end #fd.each
9897

modules/exploits/multi/http/phpldapadmin_query_engine.rb

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -87,13 +87,6 @@ def get_session
8787
return res.get_cookies
8888
end
8989

90-
def cleanup
91-
# We may not be using php/exe again, so clear the CMD option
92-
if datastore['CMD']
93-
datastore['CMD'] = nil
94-
end
95-
end
96-
9790
def exploit
9891
# if we are using the exec CMD stager
9992
# important to check which php functions are disabled

0 commit comments

Comments
 (0)