| 1 |
|
|---|
| 2 |
require 'msf/core' |
|---|
| 3 |
|
|---|
| 4 |
module Msf |
|---|
| 5 |
|
|---|
| 6 |
class Auxiliary::Test::HardeningDirListSSL < Msf::Auxiliary |
|---|
| 7 |
include Exploit::Remote::HttpClient |
|---|
| 8 |
|
|---|
| 9 |
def initialize(info = {}) |
|---|
| 10 |
super(update_info(info,{ |
|---|
| 11 |
'Name' => 'SSL/HTTPS', |
|---|
| 12 |
'Author' => [ 'Joern Bratzke, Recurity Labs GmbH <joern@recurity-labs.com>' ], |
|---|
| 13 |
'Version' => "0.9", |
|---|
| 14 |
})) |
|---|
| 15 |
register_options([ |
|---|
| 16 |
OptString.new('URI1',[true,'First Directory to check for listing', '/test1/']), |
|---|
| 17 |
OptString.new('URI2',[true,'Secound Directory to check for listing', '/test2/']), |
|---|
| 18 |
OptString.new('Signature', [true,'Signature for directory listing' , "Parent Directory"]), |
|---|
| 19 |
Opt::SSL(true), |
|---|
| 20 |
Opt::RPORT(443), |
|---|
| 21 |
],self.class) |
|---|
| 22 |
end |
|---|
| 23 |
|
|---|
| 24 |
def run |
|---|
| 25 |
check |
|---|
| 26 |
end |
|---|
| 27 |
def check |
|---|
| 28 |
numlistings = check_dir_listing(datastore['URI1']) |
|---|
| 29 |
numlistings = check_dir_listing(datastore['URI2']) |
|---|
| 30 |
print_status(" *** Summary: *** \n") |
|---|
| 31 |
print_status("Found #{numlistings} directory listings.") |
|---|
| 32 |
end |
|---|
| 33 |
def check_dir_listing(uri) |
|---|
| 34 |
n = 0 |
|---|
| 35 |
print_status("Checking for enabled directory listing at #{uri}") |
|---|
| 36 |
res = send_request_raw({'uri' => uri,'method' => "GET"},10) |
|---|
| 37 |
if not res then |
|---|
| 38 |
print_status("No response from the server") |
|---|
| 39 |
return 0 |
|---|
| 40 |
end |
|---|
| 41 |
if res.code == 404 then |
|---|
| 42 |
print_status("Requested directory not found on server!\n") |
|---|
| 43 |
return 0 |
|---|
| 44 |
end |
|---|
| 45 |
if res.body.include?(datastore['Signature']) then |
|---|
| 46 |
print_status("FOUND directory listing at #{uri}\n") |
|---|
| 47 |
n += 1 |
|---|
| 48 |
else |
|---|
| 49 |
print_status("NO directory listing at #{uri}\n") |
|---|
| 50 |
end |
|---|
| 51 |
n |
|---|
| 52 |
end |
|---|
| 53 |
end |
|---|
| 54 |
end |
|---|