How to enable ASLR, DEP and SafeSEH in exe in code blocks using mingw?

I tried using -dynamicbase -pie and -e_mainCRTStartup in the linker options for ASLR, but when I load it in ollydbg it always loads from 400000

+4
source share
1 answer

You can enable DEP with -Wl,--nxcompat. You can also pass --dynamicbaseto the linker in the same way, but, unfortunately, it does not highlight the necessary movement table. As a workaround you can go -Wl,--dynamicbase,--export-all-symbols. An explicit __declspec(dllexport)single character, such as mainalso works, and this is currently the workaround used in the Rust compiler. AFAIK, GCC does not implement SEH, so you did not miss anything without missing a compile-time health check (SafeSEH) for it.

+2
source

Source: https://habr.com/ru/post/1545057/


All Articles