Skip to content

Commit 6e253a5

Browse files
committed
Use Rex::Proto::DCERPC::Response
1 parent 42b14a9 commit 6e253a5

File tree

1 file changed

+18
-5
lines changed

1 file changed

+18
-5
lines changed

modules/exploits/windows/smb/ms17_010_eternalblue.rb

Lines changed: 18 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -257,8 +257,10 @@ def verify_arch
257257
return true if !datastore['VerifyArch']
258258

259259
pkt = Rex::Proto::DCERPC::Packet.make_bind(
260-
'e1af8308-5d1f-11c9-91a4-08002b14a0fa', '3.0', # Abstract Syntax: EPMv4 V3.0
261-
'71710533-beba-4937-8319-b5dbef9ccc36', '1.0' # Transfer Syntax[1]: 64bit NDR V1
260+
# Abstract Syntax: EPMv4 V3.0
261+
'e1af8308-5d1f-11c9-91a4-08002b14a0fa', '3.0',
262+
# Transfer Syntax[1]: 64bit NDR V1
263+
'71710533-beba-4937-8319-b5dbef9ccc36', '1.0'
262264
).first
263265

264266
sock = connect(false,
@@ -270,13 +272,24 @@ def verify_arch
270272
res = sock.get_once
271273
disconnect(sock)
272274

273-
return false if res.nil?
275+
begin
276+
resp = Rex::Proto::DCERPC::Response.new(res)
277+
rescue Rex::Proto::DCERPC::Exceptions::InvalidPacket => e
278+
print_error(e.to_s)
279+
return false
280+
end
274281

275282
case target_arch.first
276283
when ARCH_X64
277-
(ret = true) if res[36] == "\x00" # Ack result: Acceptance (0)
284+
# Ack result: Acceptance (0)
285+
if resp.ack_result.first == 0
286+
ret = true
287+
end
278288
when ARCH_X86
279-
(ret = true) if res[36] != "\x00" # Ack result: Provider rejection (2)
289+
# Ack result: Provider rejection (2)
290+
if resp.ack_result.first != 0
291+
ret = true
292+
end
280293
end
281294

282295
if ret

0 commit comments

Comments
 (0)