Nli*_*tis 12 linux security gcc
我想在我的各种虚拟机上做一些缓冲区溢出的实验,包括(但不限于)Debian 6、Ubuntu 12.04、Fedora 16,但是每次我尝试执行缓冲区溢出漏洞时,我都会收到以下消息:
stack smashing detected (core dumped)
Run Code Online (Sandbox Code Playgroud)
在完成我的研究后,我读到它是在编译器中实现的称为缓冲区溢出保护的功能。GCC例如使用GCC堆栈溢出保护(ProPolice) ,锵/ LLVM使用两个缓冲溢出探测器,SafeCode和AddressSanitizer。
我的问题是:既然我真的想检查我的机器上的缓冲区溢出攻击,有没有办法(编译器标志,也许是一个 linux 配置文件?)来停用缓冲区溢出保护?
Mat*_*teo 16
在 gcc ( man gcc) 上,检查由
Run Code Online (Sandbox Code Playgroud)-fstack-protector Emit extra code to check for buffer overflows, such as stack smashing attacks. >This is done by adding a guard variable to functions with vulnerable objects. This includes functions that call alloca, and functions with >buffers larger than 8 bytes. The guards are initialized when a function is entered and then checked when the function exits. If a guard check >fails, an error message is printed and the program exits. -fstack-protector-all Like -fstack-protector except that all functions are protected.
您可以通过no-在选项名称前添加来禁用两者
-fno-stack-protector -fno-stack-protector-all
Run Code Online (Sandbox Code Playgroud)
在 LLVM/Clang ( http://clang.llvm.org/docs/UsersManual.html#commandline ) 上启用/禁用 AdressSanitizer:
-f[no-]address-sanitizer:打开内存错误检测器 AddressSanitizer。
和 SAFECode ( http://safecode.cs.illinois.edu/docs/UsersGuide.html )
-f[no-] memsafety
| 归档时间: |
|
| 查看次数: |
32064 次 |
| 最近记录: |