2009-05-23 01:55:34 +00:00
|
|
|
##
|
2010-04-30 08:40:19 +00:00
|
|
|
# $Id$
|
|
|
|
##
|
|
|
|
|
|
|
|
##
|
|
|
|
# This file is part of the Metasploit Framework and may be subject to
|
2009-05-23 01:55:34 +00:00
|
|
|
# redistribution and commercial restrictions. Please see the Metasploit
|
|
|
|
# Framework web site for more information on licensing and terms of use.
|
|
|
|
# http://metasploit.com/framework/
|
|
|
|
##
|
|
|
|
|
|
|
|
|
|
|
|
require 'msf/core'
|
|
|
|
|
|
|
|
|
|
|
|
class Metasploit3 < Msf::Auxiliary
|
2010-04-30 08:40:19 +00:00
|
|
|
|
2009-05-23 01:55:34 +00:00
|
|
|
# Exploit mixins should be called first
|
|
|
|
include Msf::Exploit::Remote::HttpClient
|
|
|
|
include Msf::Auxiliary::WMAPScanServer
|
|
|
|
# Scanner mixin should be near last
|
|
|
|
include Msf::Auxiliary::Scanner
|
|
|
|
include Msf::Auxiliary::Report
|
|
|
|
|
|
|
|
def initialize
|
|
|
|
super(
|
|
|
|
'Name' => 'HTTP WebDAV Scanner',
|
2009-11-17 00:05:19 +00:00
|
|
|
'Version' => '$Revision$',
|
2009-05-23 01:55:34 +00:00
|
|
|
'Description' => 'Detect webservers with WebDAV enabled',
|
|
|
|
'Author' => ['et'],
|
|
|
|
'License' => MSF_LICENSE
|
|
|
|
)
|
2010-04-30 08:40:19 +00:00
|
|
|
|
2009-05-23 01:55:34 +00:00
|
|
|
end
|
|
|
|
|
|
|
|
def run_host(target_host)
|
|
|
|
|
|
|
|
begin
|
|
|
|
res = send_request_raw({
|
2010-04-30 08:40:19 +00:00
|
|
|
'uri' => '/',
|
2009-05-23 01:55:34 +00:00
|
|
|
'method' => 'OPTIONS'
|
|
|
|
}, 10)
|
|
|
|
|
|
|
|
if res and res.code == 200
|
2010-04-30 08:40:19 +00:00
|
|
|
|
2010-06-25 20:53:12 +00:00
|
|
|
http_fingerprint({ :response => res })
|
|
|
|
|
2009-05-23 01:55:34 +00:00
|
|
|
tserver = res.headers['Server']
|
2010-04-30 08:40:19 +00:00
|
|
|
|
2010-12-08 16:22:04 +00:00
|
|
|
if (res.headers['DAV'].to_s == '1, 2')
|
2009-05-23 01:55:34 +00:00
|
|
|
wdtype = 'WEBDAV'
|
|
|
|
if res.headers['X-MSDAVEXT']
|
|
|
|
wdtype = 'SHAREPOINT DAV'
|
2010-04-30 08:40:19 +00:00
|
|
|
end
|
|
|
|
|
2009-05-23 01:55:34 +00:00
|
|
|
print_status("#{target_host} (#{tserver}) has #{wdtype} ENABLED")
|
|
|
|
|
|
|
|
report_note(
|
2010-06-25 20:53:12 +00:00
|
|
|
{
|
|
|
|
:host => target_host,
|
2011-02-04 01:54:32 +00:00
|
|
|
:proto => 'tcp',
|
|
|
|
:sname => 'HTTP',
|
2010-06-25 20:53:12 +00:00
|
|
|
:port => rport,
|
|
|
|
:type => wdtype,
|
|
|
|
:data => 'enabled'
|
|
|
|
})
|
2009-05-23 01:55:34 +00:00
|
|
|
|
|
|
|
else
|
|
|
|
print_status("#{target_host} (#{tserver}) WebDAV disabled.")
|
|
|
|
end
|
2010-04-30 08:40:19 +00:00
|
|
|
end
|
|
|
|
|
2009-05-23 01:55:34 +00:00
|
|
|
rescue ::Rex::ConnectionRefused, ::Rex::HostUnreachable, ::Rex::ConnectionTimeout
|
|
|
|
rescue ::Timeout::Error, ::Errno::EPIPE
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|