Skip to content

Commit fcca79b

Browse files
committed
Merge pull request #2 from jhart-r7/landing-4503
Correct McAfee credential storage, prepare for store_loot
2 parents f4f4787 + 8889f95 commit fcca79b

File tree

1 file changed

+14
-34
lines changed

1 file changed

+14
-34
lines changed

modules/post/windows/gather/credentials/mcafee_hashdump.rb

Lines changed: 14 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -91,56 +91,36 @@ def extract_hashes_and_versions(keys)
9191

9292
def process_hashes_and_versions(hashes_and_versions)
9393
hashes_and_versions.each do |hash, version|
94-
if version >= VERSION_8 && version < VERSION_9
95-
# Base64 decode hash
96-
hash = Rex::Text.to_hex(Rex::Text.decode_base64(hash), "")
97-
print_good("McAfee v8 password hash: #{hash}")
98-
hashtype = 'dynamic_1405'
99-
elsif version >= VERSION_5 && version < VERSION_6
100-
print_good("McAfee v5 password hash: #{hash}")
94+
if version >= VERSION_5 && version < VERSION_6
10195
hashtype = 'md5u'
96+
version_name = 'v5'
10297
else
103-
print_warning("Could not identify the version of McAfee - Assuming v8")
104-
print_good("McAfee v8 password hash: #{hash}")
98+
# Base64 decode hash
99+
hash = Rex::Text.to_hex(Rex::Text.decode_base64(hash), "")
105100
hashtype = 'dynamic_1405'
101+
version_name = 'v8'
102+
if !(version >= VERSION_8 && version < VERSION_9)
103+
print_warning("Unknown McAfee version #{version_name} - Assuming v8")
104+
end
106105
end
107106

108-
# report
109-
service_data = {
110-
address: ::Rex::Socket.getaddress(session.sock.peerhost, true),
111-
port: rport,
112-
service_name: 'McAfee',
113-
protocol: 'tcp',
114-
workspace_id: myworkspace_id
115-
}
107+
print_good("McAfee #{version_name} (#{hashtype}) password hash: #{hash}")
116108

117-
# Initialize Metasploit::Credential::Core object
118109
credential_data = {
119110
post_reference_name: refname,
120111
origin_type: :session,
121-
private_type: :password,
112+
private_type: :nonreplayable_hash,
122113
private_data: hash,
123114
session_id: session_db_id,
124115
jtr_format: hashtype,
125116
workspace_id: myworkspace_id,
126-
username: "null"
127117
}
128118

129-
# Merge the service data into the credential data
130-
credential_data.merge!(service_data)
131-
132-
# Create the Metasploit::Credential::Core object
133-
credential_core = create_credential(credential_data)
119+
create_credential(credential_data)
134120

135-
# Assemble the options hash for creating the Metasploit::Credential::Login object
136-
login_data = {
137-
core: credential_core,
138-
status: Metasploit::Model::Login::Status::UNTRIED
139-
}
140-
141-
# Merge in the service data and create our Login
142-
create_credential_login(login_data.merge!(service_data))
121+
# TODO: store_loot the file in the appropriate format, which likely means
122+
# iterating over hashes_and_versions differently so that they are grouped
123+
# by version (because john can only crack one format at a time)
143124
end
144125
end
145-
146126
end

0 commit comments

Comments
 (0)