Skip to content

Commit 44d60c0

Browse files
authored
Merge pull request #21347 from g0tmi1k/smb_version
smb_version: Make SMBv1 happy
2 parents aaf536d + b7f1360 commit 44d60c0

2 files changed

Lines changed: 13 additions & 11 deletions

File tree

lib/msf/core/exploit/remote/smb/client.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -413,7 +413,7 @@ def smb_fingerprint
413413
# Leverage Recog for SMB native OS fingerprinting
414414
fp_match = Recog::Nizer.match('smb.native_os', fprint['native_os']) || { }
415415

416-
os = fp_match['os.product'] || 'Unknown'
416+
os = fp_match['os.product'] || fp_match['os.family'] || 'Unknown'
417417
sp = fp_match['os.version'] || ''
418418

419419
# Metasploit prefers 'Windows 2003' vs 'Windows Server 2003'

modules/auxiliary/scanner/smb/smb_version.rb

Lines changed: 12 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -153,19 +153,19 @@ def smb_proto_info
153153
end
154154

155155
def smb_description(info)
156-
desc = "SMB Detected (versions:#{info[:versions].join(', ')}) (preferred dialect:#{info[:preferred_dialect]})"
156+
desc = "SMB Detected (versions: #{info[:versions].join(', ')}) (preferred dialect: #{info[:preferred_dialect]})"
157157
info[:capabilities].each do |name, values|
158-
desc << " (#{name} capabilities:#{values.join(', ')})"
158+
desc << " (#{name} capabilities: #{values.join(', ')})"
159159
end
160160

161161
if info[:signing_required]
162-
desc << ' (signatures:required)'
162+
desc << ' (signatures: required)'
163163
else
164-
desc << ' (signatures:optional)'
164+
desc << ' (signatures: optional)'
165165
end
166-
desc << " (uptime:#{info[:uptime]})" if info[:uptime]
167-
desc << " (guid:#{Rex::Text.to_guid(info[:server_guid])})" if info[:server_guid]
168-
desc << " (authentication domain:#{info[:auth_domain]})" if info[:auth_domain]
166+
desc << " (uptime: #{info[:uptime]})" if info[:uptime]
167+
desc << " (guid: #{Rex::Text.to_guid(info[:server_guid])})" if info[:server_guid]
168+
desc << " (authentication domain: #{info[:auth_domain]})" if info[:auth_domain]
169169

170170
desc
171171
end
@@ -213,13 +213,13 @@ def smb_os_description(res, info, nd_smb_fingerprint)
213213
end
214214

215215
if !res['build'].to_s.empty?
216-
words << " (build:#{res['build']})"
216+
words << " (build: #{res['build']})"
217217
nd_smb_fingerprint[:os_build] = res['build']
218218
nd_fingerprint_match['os.build'] = res['build']
219219
end
220220

221221
if !res['lang'].to_s.empty? && res['lang'] != 'Unknown'
222-
words << " (language:#{res['lang']})"
222+
words << " (language: #{res['lang']})"
223223
nd_smb_fingerprint[:os_lang] = res['lang']
224224
nd_fingerprint_match['os.language'] = nd_smb_fingerprint[:os_lang]
225225
end
@@ -299,9 +299,11 @@ def run_host(ip)
299299
if info[:os_name] && info[:os_name] != 'Unknown'
300300
smb_desc = smb_description(info)
301301
os_desc = "Host is running #{info[:os_name]}"
302+
smb1_desc = smb1_fingerprint['native_lm'] ? "; #{smb1_fingerprint['native_lm']}" : ""
302303

303304
lines << { type: :status, message: smb_desc }
304305
lines << { type: :good, message: " #{os_desc}" }
306+
lines << { type: :status, message: " #{smb1_fingerprint['native_lm']}", verbose: true } if smb1_fingerprint['native_lm']
305307

306308
unless info[:signing_required]
307309
lines << { type: :status, message: ' SMB signing is not required' }
@@ -322,7 +324,7 @@ def run_host(ip)
322324
port: rport,
323325
proto: 'tcp',
324326
name: 'smb',
325-
info: "#{smb_desc}; #{os_desc}"
327+
info: "#{smb_desc}; #{os_desc}#{smb1_desc}"
326328
)
327329

328330
# Report a fingerprint.match hash for name, domain, and language

0 commit comments

Comments
 (0)