shellcode编写

ShellCode的编写就是将函数或变量在内存中的间接地址改为函数或变量在内存中的直接地址,直接调用!

MessageBox函数为例进行讲解如下

新建shellcode.cpp

shellcode编写

编写代码如下:

shellcode编写

运行结果:

shellcode编写

VC代码转换成汇编指令:

shellcode编写

shellcode编写

shellcode编写

shellcode编写

内存数据图:

shellcode编写

函数的真实地址找到之后,修改代码如下:

shellcode编写

将以上汇编指令转换成二进制数据:

shellcode编写

shellcode编写

内存数据图:

shellcode编写

0x0040103C~0x00401049之间的二进制数据复制出来

如下:

6A 00 6A 00 6A 00 6A 00 B8 1E FD 0B 75 FF D0

最终shellcode代码:

shellcode编写

运行结果:

shellcode编写