2009-05-23 01:55:34 +00:00
|
|
|
##
|
2012-03-01 22:54:04 +00:00
|
|
|
# $Id$
|
2010-04-30 08:40:19 +00:00
|
|
|
##
|
|
|
|
|
|
|
|
##
|
|
|
|
# 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
|
2012-02-21 01:40:50 +00:00
|
|
|
# web site for more information on licensing and terms of use.
|
|
|
|
# http://metasploit.com/
|
2009-05-23 01:55:34 +00:00
|
|
|
##
|
|
|
|
|
|
|
|
|
|
|
|
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
|
2012-02-03 21:43:21 +00:00
|
|
|
include Msf::Auxiliary::WmapScanServer
|
2009-05-23 01:55:34 +00:00
|
|
|
# Scanner mixin should be near last
|
|
|
|
include Msf::Auxiliary::Scanner
|
|
|
|
include Msf::Auxiliary::Report
|
|
|
|
|
|
|
|
def initialize
|
|
|
|
super(
|
|
|
|
'Name' => 'HTTP WebDAV Scanner',
|
2012-03-01 22:59:54 +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
|
|
|
|
2011-10-25 18:32:02 +00:00
|
|
|
register_options(
|
|
|
|
[
|
|
|
|
OptString.new('PATH', [true, "Path to use", '/']),
|
|
|
|
], self.class)
|
2009-05-23 01:55:34 +00:00
|
|
|
end
|
|
|
|
|
|
|
|
def run_host(target_host)
|
|
|
|
|
|
|
|
begin
|
|
|
|
res = send_request_raw({
|
2011-10-25 18:32:02 +00:00
|
|
|
'uri' => datastore['PATH'],
|
2009-05-23 01:55:34 +00:00
|
|
|
'method' => 'OPTIONS'
|
|
|
|
}, 10)
|
|
|
|
|
|
|
|
if res and res.code == 200
|
2010-06-25 20:53:12 +00:00
|
|
|
http_fingerprint({ :response => res })
|
|
|
|
|
2009-05-23 01:55:34 +00:00
|
|
|
tserver = res.headers['Server']
|
2011-11-12 19:17:26 +00:00
|
|
|
tdav = res.headers['DAV'].to_s
|
2010-04-30 08:40:19 +00:00
|
|
|
|
2011-11-12 19:17:26 +00:00
|
|
|
if (tdav == '1, 2' or tdav[0,3] == '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
|
|
|
{
|
2011-11-12 19:17:26 +00:00
|
|
|
:host => target_host,
|
|
|
|
:proto => 'tcp',
|
2012-02-18 04:59:48 +00:00
|
|
|
:sname => (ssl ? 'https' : 'http'),
|
2011-11-12 19:17:26 +00:00
|
|
|
:port => rport,
|
|
|
|
:type => wdtype,
|
2012-01-09 16:33:45 +00:00
|
|
|
:data => datastore['PATH']
|
2010-06-25 20:53:12 +00:00
|
|
|
})
|
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
|