3
3
# Current source: https://github.com/rapid7/metasploit-framework
4
4
##
5
5
6
- require 'msf/core'
7
-
8
6
class MetasploitModule < Msf ::Auxiliary
9
7
10
8
include Msf ::Exploit ::Remote ::SMB ::Client
@@ -56,6 +54,11 @@ def calculate_doublepulsar_xor_key(s)
56
54
x & 0xffffffff # this line was added just to truncate to 32 bits
57
55
end
58
56
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
+
59
62
def run_host ( ip )
60
63
begin
61
64
ipc_share = "\\ \\ #{ ip } \\ IPC$"
@@ -76,16 +79,17 @@ def run_host(ip)
76
79
)
77
80
78
81
# 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 )
80
83
81
84
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 } " )
84
88
report_vuln (
85
89
host : ip ,
86
90
name : "MS17-010 DoublePulsar Infection" ,
87
91
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 } "
89
93
)
90
94
end
91
95
elsif status == "STATUS_ACCESS_DENIED" or status == "STATUS_INVALID_HANDLE"
@@ -131,7 +135,7 @@ def do_smb_doublepulsar_probe(tree_id)
131
135
pkt = Rex ::Proto ::SMB ::Constants ::SMB_TRANS_RES_HDR_PKT . make_struct
132
136
pkt . from_s ( bytes [ 4 ..-1 ] )
133
137
134
- return pkt [ 'SMB' ] . v [ 'MultiplexID' ] , pkt [ 'SMB' ] . v [ 'Signature1' ]
138
+ return pkt [ 'SMB' ] . v [ 'MultiplexID' ] , pkt [ 'SMB' ] . v [ 'Signature1' ] , pkt [ 'SMB' ] . v [ 'Signature2' ]
135
139
end
136
140
137
141
def do_smb_ms17_010_probe ( tree_id )
0 commit comments