我试图运行这段代码来获取shell,但即使禁用了ASLR,我也会遇到分段错误.我在我的AMD Ryzen 3电脑上运行这段代码,Ubuntu 20.04 64位版本.
我正在使用以下命令编译:
gcc -O0 -fno-stack-protector -z execstack getshell.c -o getshell
文件getshell.c如下:
#include <stdio.h>
unsigned char shellcode[] = \
"\x48\x31\xf6\x56\x48\xbf\x2f\x62\x69\x6e\x2f\x2f\x73\x68\x57\x54\x5f\x6a\x3b\x58\x99\x0f\x05";
int main()
{
int (*ret)() = (int(*)())shellcode;
ret();
}
编辑:我找到了这段代码here