漏洞利用测试:如何测试/执行shellcode?

时间:2016-11-23 13:16:27

标签: c++ exploit shellcode

目前我正在了解漏洞以及如何编写漏洞利用程序。现在我正在尝试进行一项练习,我必须控制EIP(在我进行堆栈缓冲区溢出后)并执行一些shellcode。

问题是我的shellcode没有做任何事情。所以我尝试从C程序执行它来验证它是否正常工作。

这是我的代码:

#include<stdio.h>
#include<string.h>
#include<windows.h>


char shellcode[] = "\x31\xd2\xb2\x30\x64\x8b\x12\x8b\x52\x0c\x8b\x52\x1c\x8b\x42"
"\x08\x8b\x72\x20\x8b\x12\x80\x7e\x0c\x33\x75\xf2\x89\xc7\x03"
"\x78\x3c\x8b\x57\x78\x01\xc2\x8b\x7a\x20\x01\xc7\x31\xed\x8b"
"\x34\xaf\x01\xc6\x45\x81\x3e\x46\x61\x74\x61\x75\xf2\x81\x7e"
"\x08\x45\x78\x69\x74\x75\xe9\x8b\x7a\x24\x01\xc7\x66\x8b\x2c"
"\x6f\x8b\x7a\x1c\x01\xc7\x8b\x7c\xaf\xfc\x01\xc7\x68\x79\x74"
"\x65\x01\x68\x6b\x65\x6e\x42\x68\x20\x42\x72\x6f\x89\xe1\xfe"
"\x49\x0b\x31\xc0\x51\x50\xff\xd7";


int main(int argc, char **argv)
{
    int(*f)();
    f = (int(*)())shellcode;(int)(*f)();
}

但是当我执行它时,我收到此错误: C2440 (click here for photo) enter image description here

  

C2440:'type cast'::cannot convert from 'char[114]' to 'int (_cdecl*)(void)'

我不知道如何解决此错误。

0 个答案:

没有答案