1.5.8 Ensure kernel.randomize_va_space is configured

Information

Address space layout randomization (ASLR) is an exploit mitigation technique which randomly arranges the address space of key data areas of a process.

More information about the kernel parameter configuration files, their location, and load preference is available in the section overview.

Randomly placing virtual memory regions will make it difficult to write memory page exploits as the memory placement will be consistently shifting.

Solution

- Run the following command to comment out kernel.randomize_va_space lines returned by the audit procedure that are not kernel.randomize_va_space = 2 :

# sed -ri '^\s*kernel.randomize_va_space\s*=\s*[0,1]/s/^/#/g' "path/to/file/in/audit/filename"

Example:

# sed -ri '/^\s*kernel.randomize_va_space\s*=\s*[0,1]/s/^/#/g' /etc/sysctl.d/99-sysctl.conf
- Create or edit a file in the /etc/sysctl.d/ directory ending in .conf and edit or add the following line:

kernel.randomize_va_space = 2

Example:

# [ ! -d "/etc/sysctl.d/" ] && mkdir -p /etc/sysctl.d/
# printf '%s\n' "" "kernel.randomize_va_space = 2" >> /etc/sysctl.d/60-kernel_sysctl.conf
- Run the following command to load all system configuration filles:

# sysctl --system

See Also

https://workbench.cisecurity.org/benchmarks/25279

Item Details

Category: SYSTEM AND INFORMATION INTEGRITY

References: 800-53|SI-16, CCI|CCI-002824, CSCv7|8.3, Rule-ID|SV-230280r1017093_rule, Rule-ID|SV-234862r958928_rule, Rule-ID|SV-248594r958928_rule, Rule-ID|SV-257809r1044866_rule, Rule-ID|SV-260474r958928_rule, Rule-ID|SV-269452r1050335_rule, Rule-ID|SV-270772r1066805_rule, Rule-ID|SV-271761r1091995_rule

Plugin: Unix

Control ID: 1ce12b083321ab9740638c2e1926067fd44c410814fa7a6e124b4cbd7de612b0