File tree Expand file tree Collapse file tree 1 file changed +2
-2
lines changed Expand file tree Collapse file tree 1 file changed +2
-2
lines changed Original file line number Diff line number Diff line change @@ -32,7 +32,7 @@ int main(int argc, char **argv) {
32
32
我们利用如下命令对齐进行编译
33
33
34
34
```shell
35
- ➜ stack-example gcc -m32 -fno-stack-protector stack_example.c -o stack_example
35
+ ➜ stack-example gcc -m32 -fno-stack-protector -no-pie stack_example.c -o stack_example
36
36
stack_example.c: In function ‘vulnerable’:
37
37
stack_example.c:6:3: warning: implicit declaration of function ‘gets’ [-Wimplicit-function-declaration]
38
38
gets(s);
@@ -45,7 +45,7 @@ stack_example.c:(.text+0x27): 警告: the `gets' function is dangerous and sho
45
45
46
46
> 历史上,** 莫里斯蠕虫** 第一种蠕虫病毒就利用了gets这个危险函数实现了栈溢出。
47
47
48
- 此外,` -m32 ` 指的是生成32位程序; ` -fno-stack-protector ` 指的是不开启堆栈溢出保护,即不生成canary。此外,该程序并没有开启ASLR保护。 这是为了更加方便地介绍栈溢出的基本利用方式。之后,我们利用IDA来反编译一下二进制程序并查看vulnerable函数 。可以看到
48
+ 此外,` -m32 ` 指的是生成32位程序; ` -fno-stack-protector ` 指的是不开启堆栈溢出保护,即不生成canary。此外,该程序并没有开启ASLR保护(Linux下对应PIE), 这是为了更加方便地介绍栈溢出的基本利用方式。之后,我们利用IDA来反编译一下二进制程序并查看vulnerable函数 。可以看到
49
49
50
50
``` C
51
51
int vulnerable ()
You can’t perform that action at this time.
0 commit comments