1.5.3 Ensure suid_dumpable is configured

Information

fs.suid_dumpable governs whether a privileged process (with the setuid bit) can generate a core dump, regardless of other configurations.

fs.suid_dumpable values:

- 0 (default) - Any process that has changed privilege levels (like SUID programs) or is execute-only will not dump core.
- 1 (debug) - All processes dump core if possible. The core dump is owned by the current user and security is not applied. This is primarily intended for system debugging.
- 2 (suidsafe) - Any binary that normally wouldn't be dumped is dumped, but only if the core_pattern is set to a pipe handler or a fully qualified path. This mode is suitable for administrators debugging in a production environment.

core dumps may contain sensitive in-memory data like password hashes or keys. An attacker could potentially exploit this to gain access to such data.

Solution

- Review all files ending in .conf in the /etc/sysctl.d directory and comment out or remove all fs.suid_dumpable lines that are not fs.suid_dumpable=0.

Example script:

#!/usr/bin/env bash

{
l_option="fs.suid_dumpable" l_grep="${l_option//./\\.}" l_value="0"
while IFS= read -r -d $'\0' l_file; do
grep -Poi '\h*'"$l_option"'\h*=\h*\H+\b' "$l_file" \
| grep -Pivq '^\h*'"$l_grep"'\h*=\h*'"$l_value"'\b' && \
sed -ri '/^\s*kernel.yama.ptrace_scope\s*=/s/^/# /' "$l_file"
done < <(find /etc/sysctl.d/ -type f -name '*.conf' -print0)
}
- Create or edit a file in the /etc/sysctl.d/ directory ending in .conf and edit or add the following line:

fs.suid_dumpable = 0

Example:

# [ ! -d "/etc/sysctl.d/" ] && mkdir -p /etc/sysctl.d/
# printf '%s\n' "" "fs.suid_dumpable = 0" >> /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/24330

Item Details

Category: ACCESS CONTROL, CONFIGURATION MANAGEMENT

References: 800-53|AC-6(10), 800-53|CM-7

Plugin: Unix

Control ID: 2e952a8f1a76196c77de388db917d8f29dbfa44ebdee87f099fdff808e2b25a4