Information
Address space layout randomization (ASLR) is an exploit mitigation technique which randomly arranges the address space of key data areas of a process.
NOTE Starting from FreeBSD 13.2 ASLR is enabled by default.
Randomly placing virtual memory regions will make it difficult to write memory page exploits as the memory placement will be consistently shifting.
Solution
Set the following parameter in /etc/sysctl.conf :
- kern.elf64.aslr.enable=1
Example:
# printf "
kern.elf64.aslr.enable=1
" >> /etc/sysctl.conf
Run the following command to set the active kernel parameter:
# sysctl kern.elf64.aslr.enable=1
Note: If these settings appear in a canonically later file, or later in the same file, these settings will be overwritten