1. 新增保護編譯/鏈接參數
ITEM |
OPTION |
NOTE |
RELRO |
-Wl,-z,relro,-z,now or -z relro -z now |
Linker option |
STACK CANARY |
-fstack-protector-all |
Compiler option |
PIE (Executable binary) |
-fPIE -pie |
Compiler option: -fPIE (e.g. CFLAG += “-fPIE”) Linker option: -pie (e.g. LDFLAG += “-pie”) |
PIE (Shared library) |
-fPIC |
Compiler option |
2 驗證方法
checksec是一個腳本軟件,也就是用腳本寫的一個文件,不到2000行,可用來學習shell。
源碼參見:
http://www.trapkit.de/tools/checksec.html
https://github.com/slimm609/checksec.sh/
下載方法之一為:
https://github.com/slimm609/checksec.sh/archive/1.6.tar.gz
checksec到底是用來干什么的?
它是用來檢查可執行文件屬性,例如PIE, RELRO, PaX, Canaries, ASLR, Fortify Source等等屬性。
checksec的使用方法:
checksec –file libTest.so