2009-08-10 00:01:38 +00:00
|
|
|
##
|
2012-02-03 21:43:21 +00:00
|
|
|
# $Id: webdav_internal_ip.rb 14137 2011-11-01 17:57:11Z sinn3r $
|
2010-04-30 08:40:19 +00:00
|
|
|
##
|
|
|
|
|
|
|
|
##
|
|
|
|
# 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
|
2012-02-21 01:40:50 +00:00
|
|
|
# web site for more information on licensing and terms of use.
|
|
|
|
# http://metasploit.com/
|
2009-08-10 00:01:38 +00:00
|
|
|
##
|
|
|
|
|
|
|
|
|
|
|
|
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
|
2012-02-03 21:43:21 +00:00
|
|
|
include Msf::Auxiliary::WmapScanServer
|
2009-08-10 00:01:38 +00:00
|
|
|
# Scanner mixin should be near last
|
|
|
|
include Msf::Auxiliary::Scanner
|
|
|
|
include Msf::Auxiliary::Report
|
|
|
|
|
|
|
|
def initialize
|
|
|
|
super(
|
|
|
|
'Name' => 'HTTP WebDAV Internal IP Scanner',
|
2012-02-03 21:43:21 +00:00
|
|
|
'Version' => '$Revision: 14137 $',
|
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
|
|
|
|
2011-11-01 17:57:11 +00:00
|
|
|
register_options(
|
|
|
|
[
|
|
|
|
OptString.new("PATH", [true, "Path to use", '/']),
|
|
|
|
], self.class)
|
2009-08-10 00:01:38 +00:00
|
|
|
end
|
|
|
|
|
|
|
|
def run_host(target_host)
|
|
|
|
|
|
|
|
begin
|
|
|
|
res = send_request_cgi({
|
2011-11-01 17:57:11 +00:00
|
|
|
'uri' => datastore['PATH'],
|
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',
|
2012-02-18 04:59:48 +00:00
|
|
|
:sname => (ssl ? 'https' : '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
|
|
|
|
|