检测到 Pwnable bof 堆栈粉碎

时间:2021-07-10 10:49:43

标签: stack

enter image description here

pwnable 问题中存在缓冲区溢出问题。我使用kali-linux 64bit环境来解决这个问题。

上面的bof文件使用了canary技术,当使用"A"*52 + "\xbe\xba\xfe\xca"时,eax的最后一个值为\x00,结果为NULL值。

我不认为金丝雀保护技术有问题,但有时会访问 shell,有时则不会。

我想知道为什么。

这是代码。

#include <stdio.h>    
#include <string.h>    
#include <stdlib.h>    
void func(int key){
        char overflowme[32];
        printf("overflow me : ");
        gets(overflowme);       // smash me!
        if(key == 0xcafebabe){
                system("/bin/sh");
        }
        else{
                printf("Nah..\n");
        }
}
int main(int argc, char* argv[]){
        func(0xdeadbeef);
        return 0;
}

0 个答案:

没有答案