Enable ExecShield via sysctl
An XCCDF Rule
Description
By default on Red Hat Enterprise Linux 8 64-bit systems, ExecShield is
enabled and can only be disabled if the hardware does not support
ExecShield or is disabled in /etc/default/grub
.
Rationale
ExecShield uses the segmentation feature on all x86 systems to prevent execution in memory higher than a certain address. It writes an address as a limit in the code segment descriptor, to control where code can be executed, on a per-process basis. When the kernel places a process's memory regions such as the stack and heap higher than this address, the hardware prevents execution in that address range. This is enabled by default on the latest Red Hat and Fedora systems if supported by the hardware.
- ID
- xccdf_org.ssgproject.content_rule_sysctl_kernel_exec_shield
- Severity
- Medium
- References
- Updated
Remediation - Ansible
- name: Update grub defaults and the bootloader menu
command: /sbin/grubby --update-kernel=ALL --remove-args="noexec"
when: ansible_virtualization_type not in ["docker", "lxc", "openvz", "podman", "container"]
tags:
- CCE-80914-5
- NIST-800-171-3.1.7
Remediation - Shell Script
# Remediation is applicable only in certain platforms
if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; then
grubby --update-kernel=ALL --remove-args=noexec --env=/boot/grub2/grubenv
else