2009-08-10 00:01:38 +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-08-10 00:01:38 +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-08-10 00:01:38 +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 Internal IP Scanner',
|
2009-11-17 00:05:19 +00:00
|
|
|
'Version' => '$Revision$',
|
2009-08-10 00:01:38 +00:00
|
|
|
'Description' => 'Detect webservers internal IPs though WebDAV',
|
|
|
|
'Author' => ['et'],
|
|
|
|
'License' => MSF_LICENSE
|
|
|
|
)
|
2010-04-30 08:40:19 +00:00
|
|
|
|
2009-08-10 00:01:38 +00:00
|
|
|
end
|
|
|
|
|
|
|
|
def run_host(target_host)
|
|
|
|
|
|
|
|
begin
|
|
|
|
res = send_request_cgi({
|
2010-04-30 08:40:19 +00:00
|
|
|
'uri' => '/',
|
2009-08-10 00:01:38 +00:00
|
|
|
'method' => 'PROPFIND',
|
|
|
|
'data' => '',
|
|
|
|
'ctype' => 'text/xml',
|
|
|
|
'version' => '1.0',
|
|
|
|
'vhost' => '',
|
|
|
|
}, 10)
|
|
|
|
|
2010-04-30 08:40:19 +00:00
|
|
|
|
|
|
|
if res and res.body
|
|
|
|
# short regex
|
2009-08-10 00:01:38 +00:00
|
|
|
intipregex = /(192\.168\.[0-9]{1,3}\.[0-9]{1,3}|10\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}|172\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3})/i
|
|
|
|
|
|
|
|
#print_status("#{res.body}")
|
|
|
|
|
|
|
|
result = res.body.scan(intipregex).uniq
|
2010-04-30 08:40:19 +00:00
|
|
|
|
2009-11-25 06:08:28 +00:00
|
|
|
|
|
|
|
result.each do |addr|
|
|
|
|
print_status("Found internal IP in WebDAV response (#{target_host}) #{addr}")
|
2010-04-30 08:40:19 +00:00
|
|
|
|
2009-11-25 06:08:28 +00:00
|
|
|
report_note(
|
|
|
|
:host => target_host,
|
2011-02-04 01:54:32 +00:00
|
|
|
:proto => 'tcp',
|
|
|
|
:sname => 'HTTP',
|
2009-11-25 06:08:28 +00:00
|
|
|
:port => rport,
|
|
|
|
:type => 'INTERNAL_IP',
|
|
|
|
:data => "#{addr}"
|
|
|
|
)
|
2009-08-10 00:01:38 +00:00
|
|
|
end
|
2010-04-30 08:40:19 +00:00
|
|
|
end
|
|
|
|
|
2009-08-10 00:01:38 +00:00
|
|
|
rescue ::Rex::ConnectionRefused, ::Rex::HostUnreachable, ::Rex::ConnectionTimeout
|
|
|
|
rescue ::Timeout::Error, ::Errno::EPIPE
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|