Skip to content

Commit 7c9d793

Browse files
committed
Land rapid7#8309, arch for smb_ms17_010 DOUBLEPULSAR
2 parents 7a6a124 + 1a402ed commit 7c9d793

File tree

1 file changed

+11
-7
lines changed

1 file changed

+11
-7
lines changed

modules/auxiliary/scanner/smb/smb_ms17_010.rb

Lines changed: 11 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,6 @@
33
# Current source: https://github.com/rapid7/metasploit-framework
44
##
55

6-
require 'msf/core'
7-
86
class MetasploitModule < Msf::Auxiliary
97

108
include Msf::Exploit::Remote::SMB::Client
@@ -56,6 +54,11 @@ def calculate_doublepulsar_xor_key(s)
5654
x & 0xffffffff # this line was added just to truncate to 32 bits
5755
end
5856

57+
# The arch is adjacent to the XOR key in the SMB signature
58+
def calculate_doublepulsar_arch(s)
59+
s == 0 ? 'x86 (32-bit)' : 'x64 (64-bit)'
60+
end
61+
5962
def run_host(ip)
6063
begin
6164
ipc_share = "\\\\#{ip}\\IPC$"
@@ -76,16 +79,17 @@ def run_host(ip)
7679
)
7780

7881
# vulnerable to MS17-010, check for DoublePulsar infection
79-
code, signature = do_smb_doublepulsar_probe(tree_id)
82+
code, signature1, signature2 = do_smb_doublepulsar_probe(tree_id)
8083

8184
if code == 0x51
82-
xor_key = calculate_doublepulsar_xor_key(signature).to_s(16).upcase
83-
print_warning("Host is likely INFECTED with DoublePulsar! - XOR Key: #{xor_key}")
85+
xor_key = calculate_doublepulsar_xor_key(signature1).to_s(16).upcase
86+
arch = calculate_doublepulsar_arch(signature2)
87+
print_warning("Host is likely INFECTED with DoublePulsar! - Arch: #{arch}, XOR Key: 0x#{xor_key}")
8488
report_vuln(
8589
host: ip,
8690
name: "MS17-010 DoublePulsar Infection",
8791
refs: self.references,
88-
info: 'MultiPlexID += 0x10 on Trans2 request - XOR Key: #{xor_key}'
92+
info: "MultiPlexID += 0x10 on Trans2 request - Arch: #{arch}, XOR Key: 0x#{xor_key}"
8993
)
9094
end
9195
elsif status == "STATUS_ACCESS_DENIED" or status == "STATUS_INVALID_HANDLE"
@@ -131,7 +135,7 @@ def do_smb_doublepulsar_probe(tree_id)
131135
pkt = Rex::Proto::SMB::Constants::SMB_TRANS_RES_HDR_PKT.make_struct
132136
pkt.from_s(bytes[4..-1])
133137

134-
return pkt['SMB'].v['MultiplexID'], pkt['SMB'].v['Signature1']
138+
return pkt['SMB'].v['MultiplexID'], pkt['SMB'].v['Signature1'], pkt['SMB'].v['Signature2']
135139
end
136140

137141
def do_smb_ms17_010_probe(tree_id)

0 commit comments

Comments
 (0)