在研究缓冲区溢出时,我应该使用哪些版本的 GCC 或标志? [英] Which versions of GCC, or flags, should I use when studying buffer overflows?

查看:16
本文介绍了在研究缓冲区溢出时,我应该使用哪些版本的 GCC 或标志?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

最近,作为计算机工程专业的本科生,我一直在研究缓冲区溢出问题.只是出于兴趣,我开始研究和研究缓冲区溢出,但在尝试在我自己的计算机上使用 GCC 4.9.1(在 Debian Jessie 中)编译的 C 程序中实现它们时遇到了困难.

Recently, I've been studying buffer overflows as an undergraduate student in Computer Engineering. Simply out of interest, I began researching and studying buffer overflows, but have gotten stuck when attempting to implement them in my own C programs on my computer, compiled with GCC 4.9.1 (in Debian Jessie).

我听说在较新的编译器中有各种堆栈溢出保护,所以我认为我的问题是我的编译器版本太新了.要么,要么我没有使用正确的标志进行编译(无).

I've heard that there are sorts of stack overflow protection in newer compilers, so I'm thinking that my issue is that my compiler version is too new. Either that, or I'm not compiling with the correct flags (none).

那么有没有好的 GCC 版本可供我用来测试缓冲区溢出?或者我应该使用特定标志来防止堆栈保护和金丝雀?

So are there good versions of GCC for me to obtain to test buffer overflows? Or should I use a particular flag to prevent stack protection and canaries?

感谢您的宝贵时间.

推荐答案

使用 -zexecstack -fno-stack-protector 禁用堆栈帧保护和不可执行堆栈 gcc.

Use -zexecstack -fno-stack-protector to disable stack frame protection and non-executable stack with gcc.

在您的 Linux 系统上,您还必须使用以下方法禁用地址随机化 (ASLR):

On your Linux system, you also have to disable address randomization (ASLR) using:

echo 0 > /proc/sys/kernel/randomize_va_space

这篇关于在研究缓冲区溢出时,我应该使用哪些版本的 GCC 或标志?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆