Skip to content

Commit a47b3fe

Browse files
committed
Don't report duplicate Net-NTLM hashes
1 parent a1613d6 commit a47b3fe

File tree

1 file changed

+22
-8
lines changed

1 file changed

+22
-8
lines changed

lib/msf/core/exploit/remote/smb/server/hash_capture.rb

Lines changed: 22 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -54,14 +54,6 @@ def report_ntlm_type3(address:, ntlm_type1:, ntlm_type2:, ntlm_type3:)
5454

5555
return if hash_type.nil?
5656

57-
# TODO: write method for mapping +major+ and +minor+ OS values to human-readable OS names.
58-
# client_os_version = ::NTLM::OSVersion.read(type1_msg.os_version)
59-
print_line "[SMB] #{hash_type} Client : #{address}"
60-
# print_line "[SMB] #{hash_type} Client OS : #{client_os_version}"
61-
print_line "[SMB] #{hash_type} Username : #{domain}\\#{user}"
62-
print_line "[SMB] #{hash_type} Hash : #{combined_hash}"
63-
print_line
64-
6557
jtr_format = ntlm_message.ntlm_version == :ntlmv1 ? JTR_NTLMV1 : JTR_NTLMV2
6658

6759
if active_db?
@@ -103,9 +95,31 @@ def report_ntlm_type3(address:, ntlm_type1:, ntlm_type2:, ntlm_type3:)
10395
# found_host.os_name = credential_options[:client_os_version]
10496
# found_host.save!
10597

98+
search_options = {
99+
ptype: credential_options[:jtr_format],
100+
realm: credential_options[:realm_value],
101+
user: credential_options[:username],
102+
hosts: credential_options[:address],
103+
jtr_format: credential_options[:jtr_format],
104+
type: Metasploit::Credential::NonreplayableHash,
105+
workspace: framework.db.workspace
106+
}
107+
if framework.db.creds(search_options).count > 0
108+
vprint_status("Skipping previously captured hash for #{credential_options[:realm_value]}\\#{credential_options[:username]}")
109+
return
110+
end
111+
106112
create_credential(credential_options)
107113
end
108114

115+
# TODO: write method for mapping +major+ and +minor+ OS values to human-readable OS names.
116+
# client_os_version = ::NTLM::OSVersion.read(type1_msg.os_version)
117+
print_line "[SMB] #{hash_type} Client : #{address}"
118+
# print_line "[SMB] #{hash_type} Client OS : #{client_os_version}"
119+
print_line "[SMB] #{hash_type} Username : #{domain}\\#{user}"
120+
print_line "[SMB] #{hash_type} Hash : #{combined_hash}"
121+
print_line
122+
109123
if datastore['JOHNPWFILE']
110124
path = build_jtr_file_name(jtr_format)
111125

0 commit comments

Comments
 (0)