LinuxQuestions.org
Download your favorite Linux distribution at LQ ISO.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions > Slackware
User Name
Password
Slackware This Forum is for the discussion of Slackware Linux.

Notices


Reply
  Search this Thread
Old 02-06-2024, 01:05 AM   #46
teoberi
Member
 
Registered: Jan 2018
Location: Romania
Distribution: Slackware64-current (servers)/Windows 11/Ubuntu (workstations)
Posts: 611

Original Poster
Rep: Reputation: 355Reputation: 355Reputation: 355Reputation: 355

A new version of the "Compiler Options Hardening Guide for C and C++" document.
Quote:
To benefit from the protection mechanism provided by the OS the application binaries must be prepared at build time to be compatible with the mitigations. Typically, this means enabling specific option flags for the compiler or linker when the software is built.

Some mechanisms may require additional configuration and fine tuning, for example due to potential compilation issues for certain unlikely edge cases, or performance overhead the mitigation adds for certain program constructs. Some compiler security features depend on data flow analysis of programs and heuristics, results of which may vary depending on program source code details. As a result, the protection mechanisms implemented by these features may not always provide full coverage.

These problems are exacerbated in projects that rely on an outdated version of an open source software (OSS) compiler. In general, security mitigations are more likely to be enabled by default in modern versions of compilers included with Linux distributions. Note that the defaults used by the upstream GCC project do not enable some of these mitigations.

If compiler options hardening is overlooked or neglected during build time it can become impossible to add hardening to already distributed executables. It is therefore good practice to evaluate which mitigations an application should support, and make conscious, informed decisions whenever not enabling a mitigation weakens the application’s defensive posture. Ensure that the software is tested with as many options as practical, to ensure it can be operated that way.

Some organizations require selecting hardening rules. For example, the US government’s NIST SP 800-218 practice PW.6 requires configuring “the compilation, interpreter, and build processes to improve executable security” 7. Carnegie Mellon University (CMU)’s “top 10 secure coding practices” recommends compiling “code using the highest warning level available for your compiler and eliminate warnings by modifying the code.”8 This guide can help you do that.
 
Old 04-27-2024, 02:04 PM   #47
teoberi
Member
 
Registered: Jan 2018
Location: Romania
Distribution: Slackware64-current (servers)/Windows 11/Ubuntu (workstations)
Posts: 611

Original Poster
Rep: Reputation: 355Reputation: 355Reputation: 355Reputation: 355
Given the concerns regarding software memory safety issues raised by NSA, White House Office of the National Cyber Director (ONCD) for C/C++ but also the fact that the recommendations regarding the use of other programming languages cannot be put into practice easily and immediately because the amount of C and C++ code written over the years is immense, the solution is to secure what we had now until we can move on to something else.
So let's build more secure ELF binaries and check what we're using.
I've talked about building in previous posts, but I've also talked a bit about how to test binaries using checksec (Bash script).
There is also the alternative HardeningMeter (Python based) which I haven't used yet, I just read about it. The author says that checksec should be improved, so I started to better document myself about the development of checksec and to test the new versions. After checking the test files (tests/binaries/output) from checksec with both applications, the conclusion is that HardeningMeter is the one that suffers from the lack of accuracy and I do not recommend its use.
That's how I found out that there is a large rewrite in progress and it seems that things are moving.
Checksec 2.7.0 was released last week and is already there checksec 2.7.1 tag with improved detection for Fortify source including tests for verification.
If someone wants/is curious to find out how Slackware compares to, for example, Ubuntu, you can download the checksec script from the 2.7.1 link and run it to check all running processes:
Code:
./checksec --proc-all
Red dominates in Slackware and green in Ubuntu.
Ubuntu 24.04 LTS (Noble Numbat) released, I will test it a bit.

Last edited by teoberi; 05-02-2024 at 02:23 PM.
 
2 members found this post helpful.
Old 04-30-2024, 03:05 AM   #48
teoberi
Member
 
Registered: Jan 2018
Location: Romania
Distribution: Slackware64-current (servers)/Windows 11/Ubuntu (workstations)
Posts: 611

Original Poster
Rep: Reputation: 355Reputation: 355Reputation: 355Reputation: 355
Contrary to Linux From Scratch's warning:
Quote:
Warning
Unset any environment variables which may affect the build:

Code:
unset {C,CPP,CXX,LD}FLAGS
Don't try “tuning” this package with custom compilation flags. This package is a bootloader. The low-level operations in the source code may be broken by aggressive optimization.
building GRUB using the official Slackbuilds script from testing with the hardening options from here and everything is OK.
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Hardening, auditing, host security and network security on Slackware systems mralk3 Slackware 11 08-11-2015 03:53 PM
Linux hardening and mysql hardening sagar666 Linux - Server 3 06-18-2014 11:47 PM
[SOLVED] slackware hardening tips -Su: authentication failure san2ban Slackware 20 08-04-2013 02:08 AM
Slackware hardening guide tangle Slackware 4 03-14-2005 09:47 PM
Hardening Slackware AhYup Slackware 8 03-07-2005 06:35 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions > Slackware

All times are GMT -5. The time now is 11:39 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration