Skip to content

Commit 7a2a475

Browse files
OJBrent Cook
authored andcommitted
Fix named pipe migration stubs
1 parent 5294722 commit 7a2a475

File tree

2 files changed

+10
-28
lines changed

2 files changed

+10
-28
lines changed

lib/msf/core/payload/windows/migrate_named_pipe.rb

Lines changed: 5 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,7 @@ module Msf
1313

1414
module Payload::Windows::MigrateNamedPipe
1515

16-
include Msf::Payload::Windows
17-
include Msf::Payload::Windows::BlockApi
16+
include Msf::Payload::Windows::MigrateCommon
1817

1918
def initialize(info={})
2019
super(update_info(info,
@@ -30,23 +29,15 @@ def initialize(info={})
3029
#
3130
# Constructs the payload
3231
#
33-
def generate
32+
def generate_migrate(opts = {})
3433
%Q^
35-
migrate:
36-
cld
37-
pop esi
38-
pop esi ; esi now contains a pointer to the migrate context
39-
sub esp, 0x2000
40-
call start
41-
#{asm_block_api}
42-
start:
43-
pop ebp
34+
start_migrate_pipe:
4435
mov edi, [esi+16] ; The duplicated pipe handle is in the migrate context.
45-
signal_event:
36+
signal_pipe_event:
4637
push dword [esi] ; Event handle is pointed at by esi
4738
push #{Rex::Text.block_api_hash('kernel32.dll', 'SetEvent')}
4839
call ebp ; SetEvent(handle)
49-
call_payload:
40+
call_pipe_payload:
5041
call dword [esi+8] ; call the associated payload
5142
^
5243
end

lib/msf/core/payload/windows/x64/migrate_named_pipe.rb

Lines changed: 5 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,7 @@ module Msf
1313

1414
module Payload::Windows::MigrateNamedPipe_x64
1515

16-
include Msf::Payload::Windows
17-
include Msf::Payload::Windows::BlockApi_x64
16+
include Msf::Payload::Windows::MigrateCommon_x64
1817

1918
def initialize(info={})
2019
super(update_info(info,
@@ -30,23 +29,15 @@ def initialize(info={})
3029
#
3130
# Constructs the payload
3231
#
33-
def generate
32+
def generate_migrate(opts = {})
3433
%Q^
35-
migrate:
36-
cld
37-
mov rsi, rcx
38-
sub rsp, 0x2000
39-
and rsp, ~0xF
40-
call start
41-
#{asm_block_api}
42-
start:
43-
pop rbp
34+
start_migrate_pipe:
4435
mov rdi, qword [rsi+16] ; The duplicated pipe handle is in the migrate context.
45-
signal_event:
36+
signal_pipe_event:
4637
mov rcx, qword [rsi] ; Event handle is pointed at by rsi
4738
mov r10d, #{Rex::Text.block_api_hash('kernel32.dll', 'SetEvent')}
4839
call rbp ; SetEvent(handle)
49-
call_payload:
40+
call_pipe_payload:
5041
call qword [rsi+8] ; call the associated payload
5142
^
5243
end

0 commit comments

Comments
 (0)