Warning: file_get_contents(/data/phpspider/zhask/data//catemap/4/c/63.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/angular/26.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
C 缓冲区溢出-程序以信号SIGSEGV终止_C_Assembly_Gdb_Buffer Overflow_Exploit - Fatal编程技术网

C 缓冲区溢出-程序以信号SIGSEGV终止

C 缓冲区溢出-程序以信号SIGSEGV终止,c,assembly,gdb,buffer-overflow,exploit,C,Assembly,Gdb,Buffer Overflow,Exploit,我正在学习如何利用缓冲区溢出。我编写了这样一个易受攻击的程序: #include <stdio.h> #include <string.h> main(int argc, char *argv[]) { char buffer[80]; strcpy(buffer, argv[1]); return 1; } #包括 #包括 main(int argc,char*argv[]) { 字符缓冲区[80]; strcpy(缓冲区,argv[1]);

我正在学习如何利用缓冲区溢出。我编写了这样一个易受攻击的程序:

#include <stdio.h>
#include <string.h>

main(int argc, char *argv[])
{
    char buffer[80];
    strcpy(buffer, argv[1]);
    return 1;
}
#包括
#包括
main(int argc,char*argv[])
{
字符缓冲区[80];
strcpy(缓冲区,argv[1]);
返回1;
}
非常简单的程序。其思想是覆盖用于返回libc函数的返回地址
start\u main
。一切都很顺利,我使用GDB验证返回地址是否被指向内存中
外壳代码的正确地址覆盖

但当我打算得到一个外壳时,会出现:

程序接收信号SIGSEGV,分段故障。0xbffff178英寸??()


0xbfff178
是返回覆盖的返回地址,它确实指向
外壳代码
。有什么帮助吗?

您可能有一个无执行堆栈,它禁止从某些地址范围执行代码。您需要使用
-z execstack
进行编译,以强制堆栈可执行。

如果所有内容都发生了更改,那么堆栈如何需要执行权限?有一个不同函数的返回地址?他正在将返回地址和外壳代码写入堆栈上的字符串缓冲区。