我想寫一個非常簡單的程序,強調如何緩衝區溢出漏洞利用可以繞過密碼保護系統。通過輸入一個字符串時,要求輸入我的密碼的第二次,大於15個字符簡單的緩衝區溢出漏洞利用
#include <stdio.h>
#include <string.h>
int main(void)
{
char buff[15];
char tempbuff[15];
int pass = 0;
printf("\n Enter a password of length between 1 and 15 characters : \n");
gets(buff);
//strcpy("%s",buff);
printf("\n Enter your password : \n");
gets(tempbuff);
//strcpy("%s",tempbuff);
if(strcmp(tempbuff, buff))
{
printf ("\n Wrong Password \n");
}
else
{
printf ("\n Correct Password \n");
pass = 1;
}
if(pass)
{
/* Now Give root or admin rights to user*/
printf ("\n Root privileges given to the user \n");
}
return 0;
}
從本質上講,我試圖從0通變量的值修改爲1:該代碼如下。但是,我還沒有做到這一點。任何幫助將非常感激!
你用Google搜索「如何利用緩衝區溢出C」? – Arc676
相關:http://stackoverflow.com/questions/6220212/buffer-overflow-in-c – Arc676
我已經編譯到程序集,但似乎無法確定傳遞變量所在的位置。 – user2904796