嘻嘻,
我正在使用 gdb 来利用我的程序
int main(int argc, char *argv[]) {
if(argc < 2) {
printf("You have vergotten to fill in a value\n");
exit(0);
}
char buffer[10];
strcpy(buffer, argv[1]);
printf("the value you supplie is ");
printf(buffer);
printf("\n");
return 0;
}
在 vindeo 教程中,他在 gdb 中输入“运行 AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA” 并且应该成为:
program received signal SIGSEGV, sementation fault.
0x41414141 in ?? ()
但是我得到了SIGABRT
*** stack smashing detected ***: /root/Desktop/out terminated
======= Backtrace: =========
/lib/libc.so.6(__fortify_fail+0x37)[0x7ffff7b59217]
/lib/libc.so.6(__fortify_fail+0x0)[0x7ffff7b591e0]
/root/Desktop/out[0x400759]
/lib/libc.so.6(__libc_start_main+0xfd)[0x7ffff7a78c4d]
/root/Desktop/out[0x400609]
======= Memory map: ========
00400000-00401000 r-xp 00000000 08:01 148883 /root/Desktop /out
00600000-00601000 r--p 00000000 08:01 148883 /root/Desktop /out
00601000-00602000 rw-p 00001000 08:01 148883 /root/D
等然后是 SIGABRT
我收到 SIGABRT 而不是 SIGSEGV 的原因是什么?
最佳答案
你的编译器实现了stack smashing protection .运行时告诉你这件事。尝试将您的缓冲区放在函数之外 - 您最有可能遇到段错误。
顺便说一下,在 root
下玩漏洞并不是什么好主意。
关于c++ - gdb SIGABRT 而不是 SIGSEGV,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/11074584/