Module: Msf::Payload::Windows::Exitfunk_x64
- Included in:
- BindNamedPipe_x64, BindTcp_x64, ReverseHttp_x64, ReverseNamedPipe_x64, ReverseTcp_x64
- Defined in:
- lib/msf/core/payload/windows/x64/exitfunk_x64.rb
Overview
Implements arbitrary exit routines for Windows ARCH_X64 payloads
Instance Method Summary collapse
Instance Method Details
#asm_exitfunk(opts = {}) ⇒ Object
13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 |
# File 'lib/msf/core/payload/windows/x64/exitfunk_x64.rb', line 13 def asm_exitfunk(opts={}) asm = %Q^ exitfunk: pop rax ; won't be returning, realign the stack with a pop ^ case opts[:exitfunk] when 'seh' asm << %Q^ push 0 ; pop rcx ; set the exit function parameter mov ebx, 0x#{Msf::Payload::Windows.exit_types['seh'].to_s(16)} mov r10d, ebx ; place the correct EXITFUNK into r10d call rbp ; SetUnhandledExceptionFilter(0) push 0 ; ret ; Return to NULL (crash) ^ when 'thread' asm << %Q^ push 0 ; pop rcx ; set the exit function parameter mov ebx, 0x#{Msf::Payload::Windows.exit_types['thread'].to_s(16)} mov r10d, ebx ; place the correct EXITFUNK into r10d call rbp ; call EXITFUNK( 0 ); ^ when 'process', nil asm << %Q^ push 0 ; pop rcx ; set the exit function parameter mov r10, #{Rex::Text.block_api_hash('kernel32.dll', 'ExitProcess')} call rbp ; ExitProcess(0) ^ when 'sleep' asm << %Q^ push 300000 ; 300 seconds pop rcx ; set the sleep function parameter mov r10, #{Rex::Text.block_api_hash('kernel32.dll', 'Sleep')} call rbp ; Sleep(30000) jmp exitfunk ; repeat ^ else # Do nothing and continue after the end of the shellcode end asm end |