打开PE文件,找到IMAGE_NT_HEADERS结构
然后修改其中EntryPoint的数值指向你注入的代码开始(事先已经将代码注入到块间的空白区域)
同时在你的代码最后添加一句:
jmp oldEntryPoint
oldEntryPoint就是曾经的entryPoint
大致的流程:
Open a pe file
inject your shell code
locate nt_headers
nt_headers.entrypoint saved
nt_headers.entrypoint = address of your shell code
find last opcode in your shell code
modify 'E8 oldEntryPoint'