HRDN-7222 - Permissions on installed compilers

This information is provided as part of the Lynis community project. It is related to Lynis control HRDN-7222 and should be considered as-is and without guarantees. Any advice and commands should be tested before implementing them in production environments.

Control details
CategoryHardening
Application

Description

Compilers turn source code into binary executable code. For a production system a compiler is usually not needed, unless package upgrades are performed by means of their source code. If a compiler is found, execution should be limited to authorized users only (e.g. root user).

How to solve

Compilers are used for translating source code into machine language. This process happens usually during the development cycle, or by package maintainers. Although many systems have a compiler installed, it is often not used. That is an unnecessary risk.

Evildoers might abuse the presence of a compiler to make their malicious attacks work. Due to protections in the Linux kernel, memory allocation and execution of processes, is limited. To circumvent these protections, a compiler on the related system is needed, so the attacker can determine specific memory locations and leverage a so-called exploit.

Hardening options

When possible, removal of any unneeded compilers is the best option. This prevents users from compiling source code into binary programs. This is unusual for a production server, as most software comes precompiled. If you still need the compilers on your system, consider changing the file permissions or file ownership. This way only the root, or other privileged users, can use the compiler.

Additional resources

Need more details?

Consider the upgrade to Lynis Enterprise to receive additional details and guidance. The Enterprise version helps to you with daily health checks of your environment, learn in-depth system hardening, and resources to protect your systems better.

See demo

About

Lynis is a technical security auditing tool for Unix flavors like Linux, macOS, AIX, Solaris, and *BSD. It is open source software and free to use. Typical usage include system hardening, compliance testing, and vulnerability scanning. The project has an active community, including development via GitHub.

Lynis Enterprise

Do you need to collect data from multiple systems or compliance reporting? Lynis Enterprise uses Lynis to collect the data and make your work easier.

Benefits: automate security audits, detailed reporting, compliance testing.

  • Centralized management
  • Improvement plan with priorities
  • Reporting
  • Dashboards
  • Predefined policies
  • Integration (API)
  • Improvement snippets for tools like Ansible, Chef, Cfengine, Puppet, and SaltStack
Take the Tour