2008-09-22 22:32:20 +00:00
|
|
|
##
|
2008-10-23 02:43:21 +00:00
|
|
|
# $Id$
|
2008-09-22 22:32:20 +00:00
|
|
|
##
|
|
|
|
|
|
|
|
##
|
|
|
|
# This file is part of the Metasploit Framework and may be subject to
|
|
|
|
# redistribution and commercial restrictions. Please see the Metasploit
|
|
|
|
# Framework web site for more information on licensing and terms of use.
|
2009-04-13 14:33:26 +00:00
|
|
|
# http://metasploit.com/framework/
|
2008-09-22 22:32:20 +00:00
|
|
|
##
|
|
|
|
|
|
|
|
require 'rex/proto/http'
|
|
|
|
require 'msf/core'
|
|
|
|
|
|
|
|
#
|
|
|
|
# May I reuse some methods?
|
|
|
|
#
|
|
|
|
require 'cgi'
|
|
|
|
|
|
|
|
|
|
|
|
|
2008-10-27 02:22:30 +00:00
|
|
|
class Metasploit3 < Msf::Auxiliary
|
2008-09-22 22:32:20 +00:00
|
|
|
|
2008-10-27 02:22:30 +00:00
|
|
|
include Msf::Exploit::Remote::HttpClient
|
|
|
|
include Msf::Auxiliary::WMAPScanServer
|
|
|
|
include Msf::Auxiliary::Scanner
|
2008-09-22 22:32:20 +00:00
|
|
|
|
|
|
|
|
|
|
|
def initialize(info = {})
|
|
|
|
super(update_info(info,
|
|
|
|
'Name' => 'HTTP Virtual Host Brute Force Scanner',
|
|
|
|
'Description' => %q{
|
|
|
|
This module scans a web server for
|
|
|
|
|
|
|
|
},
|
|
|
|
'Author' => [ 'et [at] cyberspace.org' ],
|
|
|
|
'License' => BSD_LICENSE,
|
2008-10-23 02:43:21 +00:00
|
|
|
'Version' => '$Revision$'))
|
2008-09-22 22:32:20 +00:00
|
|
|
|
|
|
|
register_options(
|
|
|
|
[
|
|
|
|
OptString.new('URI', [ true, "The URL to use while testing", '/']),
|
|
|
|
OptString.new('GET_QUERY', [ false, "HTTP URI Query", '']),
|
|
|
|
OptString.new('DOMAIN', [ true, "Domain name", '']),
|
|
|
|
OptString.new('HEADERS', [ false, "HTTP Headers", '']),
|
|
|
|
], self.class)
|
|
|
|
|
|
|
|
end
|
|
|
|
|
|
|
|
def run_host(ip)
|
|
|
|
|
|
|
|
valstr = [
|
|
|
|
"admin",
|
|
|
|
"services",
|
|
|
|
"webmail",
|
|
|
|
"console",
|
|
|
|
"apps",
|
|
|
|
"mail",
|
|
|
|
"intranet",
|
|
|
|
"intra",
|
|
|
|
"corporate",
|
|
|
|
"www",
|
|
|
|
"web"
|
|
|
|
]
|
|
|
|
|
|
|
|
datastore['GET_QUERY'] ? tquery = queryparse(datastore['GET_QUERY']): nil
|
|
|
|
datastore['HEADERS'] ? thead = headersparse(datastore['HEADERS']) : nil
|
|
|
|
|
|
|
|
randhost = Rex::Text.rand_text_alpha(5)+"."+datastore['DOMAIN']
|
|
|
|
|
|
|
|
begin
|
|
|
|
noexistsres = send_request_cgi({
|
|
|
|
'uri' => datastore['URI'],
|
|
|
|
'vars_get' => tquery,
|
|
|
|
'headers' => thead,
|
|
|
|
'vhost' => randhost,
|
|
|
|
'method' => 'GET',
|
|
|
|
'ctype' => 'text/plain'
|
|
|
|
}, 20)
|
|
|
|
|
|
|
|
print_status("Sending request with random domain #{randhost} ")
|
|
|
|
|
|
|
|
rescue ::Rex::ConnectionRefused, ::Rex::HostUnreachable, ::Rex::ConnectionTimeout
|
|
|
|
rescue ::Timeout::Error, ::Errno::EPIPE
|
|
|
|
end
|
|
|
|
|
|
|
|
valstr.each do |astr|
|
|
|
|
thost = astr+"."+datastore['DOMAIN']
|
|
|
|
|
|
|
|
begin
|
|
|
|
res = send_request_cgi({
|
|
|
|
'uri' => datastore['URI'],
|
|
|
|
'vars_get' => tquery,
|
|
|
|
'headers' => thead,
|
|
|
|
'vhost' => thost,
|
|
|
|
'method' => 'GET',
|
|
|
|
'ctype' => 'text/plain'
|
|
|
|
}, 20)
|
|
|
|
|
|
|
|
if res and noexistsres
|
|
|
|
|
|
|
|
if res.body != noexistsres.body
|
|
|
|
print_status("Vhost found #{thost} ")
|
2008-10-27 02:22:30 +00:00
|
|
|
|
|
|
|
rep_id = wmap_base_report_id(
|
2009-03-28 17:45:14 +00:00
|
|
|
rhost,
|
|
|
|
rport,
|
|
|
|
ssl
|
2008-10-27 02:22:30 +00:00
|
|
|
)
|
|
|
|
|
|
|
|
wmap_report(rep_id,'VHOST','NAME',"#{thost}","Vhost #{thost} found.")
|
2008-09-22 22:32:20 +00:00
|
|
|
else
|
|
|
|
print_status("NOT Found #{thost}")
|
|
|
|
end
|
|
|
|
else
|
|
|
|
print_status("NO Response")
|
|
|
|
end
|
|
|
|
|
|
|
|
rescue ::Rex::ConnectionRefused, ::Rex::HostUnreachable, ::Rex::ConnectionTimeout
|
|
|
|
rescue ::Timeout::Error, ::Errno::EPIPE
|
|
|
|
end
|
|
|
|
|
|
|
|
end
|
|
|
|
|
|
|
|
end
|
2009-03-28 17:45:14 +00:00
|
|
|
end
|