-
Notifications
You must be signed in to change notification settings - Fork 1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Compile with hardening flags #633
base: master
Are you sure you want to change the base?
Conversation
I can't reproduce some of these environments locally, so I may need to submit a few more pull requests to get the kinks worked out. |
For what its worth we've been building the rpms with this for many years now, and a good test suite to look at the settings is: http://www.trapkit.de/tools/checksec.html As it stands right now, we still need to make some changes to the source tree to get this working right in 2.9 so I'm going to re-open this one. |
At first I didn't realize I could make a commit and have travis rebuild the pull request, so I thought I'd have to submit others (which is why I closed this one earlier). Now that the build is working, I think it's ready for someone else to review. |
I'm seeing a lot of messages I'd rather not see when compiling with this diff:
|
Ok, I'll look into that. On 08/13/2015 01:18 PM, Dan Parriott wrote:
|
Looks like this doesnt get ossec-dbd either:
|
Oh and authd is only partial: |
Is this still live, or have the v3+ compiler options included the relevant hardening bits in other commits? |
I don't think they're on by default, but they can be set during compile time. @atomicturtle might be using some of these for the packages. I imagine some of these can be set for some systems, but whether AIX and similar systems would work is a mystery. |
These flags mitigate the risk of zero-day memory corruption vulnerabilities, like buffer overflow attacks. In brief, the options added are:
-fpic -pie
Compiles position independent code, to take advantage of ASLR. This makes it harder to write exploits because it requires an information leak bug or brute force attack in addition to the memory corruption exploit.
-fstack-protector-all --param ssp-buffer-size=4
Ensures a canary is placed on the stack any time there's a potentially vulnerable function. This mitigates many stack-based overflows.
-Wl,-z,relro,-z,now
Makes relocation tables read-only, making it harder to do a return-to-libc style attack by rewriting a relocation entry.
-Wformat -Wformat-security
Complains loudly if there's an obvious format string injection vulnerability.
-D_FORTIFY_SOURCE=2
Adds some extra checks on buffer lengths.
You can read about some of these options in section 5 of https://wiki.debian.org/Hardening. Some details are also at https://wiki.ubuntu.com/ToolChain/CompilerFlags?action=show&redirect=CompilerFlags.