@@ -42,13 +42,20 @@ def initialize(info = {})
42
42
[ 'CVE' , '2017-0147' ] ,
43
43
[ 'CVE' , '2017-0148' ] ,
44
44
[ 'MSB' , 'MS17-010' ] ,
45
+ [ 'URL' , 'https://zerosum0x0.blogspot.com/2017/04/doublepulsar-initial-smb-backdoor-ring.html' ] ,
45
46
[ 'URL' , 'https://github.com/countercept/doublepulsar-detection-script' ] ,
46
47
[ 'URL' , 'https://technet.microsoft.com/en-us/library/security/ms17-010.aspx' ]
47
48
] ,
48
49
'License' => MSF_LICENSE
49
50
) )
50
51
end
51
52
53
+ # algorithm to calculate the XOR Key for DoublePulsar knocks
54
+ def calculate_doublepulsar_xor_key ( s )
55
+ x = ( 2 * s ^ ( ( ( s & 0xff00 | ( s << 16 ) ) << 8 ) | ( ( ( s >> 16 ) | s & 0xff0000 ) >> 8 ) ) )
56
+ x & 0xffffffff # this line was added just to truncate to 32 bits
57
+ end
58
+
52
59
def run_host ( ip )
53
60
begin
54
61
ipc_share = "\\ \\ #{ ip } \\ IPC$"
@@ -69,14 +76,16 @@ def run_host(ip)
69
76
)
70
77
71
78
# vulnerable to MS17-010, check for DoublePulsar infection
72
- code = do_smb_doublepulsar_probe ( tree_id )
79
+ code , signature = do_smb_doublepulsar_probe ( tree_id )
80
+
73
81
if code == 0x51
74
- print_warning ( "Host is likely INFECTED with DoublePulsar!" )
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 } " )
75
84
report_vuln (
76
85
host : ip ,
77
86
name : "MS17-010 DoublePulsar Infection" ,
78
87
refs : self . references ,
79
- info : 'MultiPlexID = 0x51 on Trans2 request'
88
+ info : 'MultiPlexID += 0x10 on Trans2 request - XOR Key: #{xor_key} '
80
89
)
81
90
end
82
91
elsif status == "STATUS_ACCESS_DENIED" or status == "STATUS_INVALID_HANDLE"
@@ -122,7 +131,7 @@ def do_smb_doublepulsar_probe(tree_id)
122
131
pkt = Rex ::Proto ::SMB ::Constants ::SMB_TRANS_RES_HDR_PKT . make_struct
123
132
pkt . from_s ( bytes [ 4 ..-1 ] )
124
133
125
- return pkt [ 'SMB' ] . v [ 'MultiplexID' ]
134
+ return pkt [ 'SMB' ] . v [ 'MultiplexID' ] , pkt [ 'SMB' ] . v [ 'Signature1' ]
126
135
end
127
136
128
137
def do_smb_ms17_010_probe ( tree_id )
0 commit comments