Skip to content

Commit 77e9996

Browse files
committed
Mitigate metasm relocation error by disabling ASLR
Deal with import error by actually using the GetProcAddress code.
1 parent 8d33138 commit 77e9996

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

lib/msf/core/exe/segment_injector.rb

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,6 @@ def create_thread_stub
3737
push hook_funcname
3838
push eax
3939
call [iat_GetProcAddress]
40-
mov eax, [iat_CreateThread]
4140
lea edx, [thread_hook]
4241
push 0
4342
push 0
@@ -85,6 +84,9 @@ def generate_pe
8584
pe.mz.encoded.export = pe_orig.encoded[0, 512].export.dup
8685
pe.header.time = pe_orig.header.time
8786

87+
# Don't rebase if we can help it since Metasm doesn't do relocations well
88+
pe.optheader.dll_characts.delete("DYNAMIC_BASE")
89+
8890
prefix = ''
8991
if pe.header.characteristics.include? "DLL"
9092
# if there is no entry point, just return after we bail or spawn shellcode

0 commit comments

Comments
 (0)