Add nosuid Option to /home
An XCCDF Rule
Description
The nosuid
mount option can be used to prevent
execution of setuid programs in /home
. The SUID and SGID permissions
should not be required in these user data directories.
Add the nosuid
option to the fourth column of
/etc/fstab
for the line which controls mounting of
/home
.
warning alert: Functionality Warning
OVAL looks for partitions whose mount point is a substring of any interactive user's home
directory and validates that noexec option is there. Because of this, there could be false
negatives when several partitions share a base substring. For example, if there is a home
directory in
Bash remediation uses the
/var/tmp/user1
and there are partitions mounted in /var
and
/var/tmp
. The noexec option is only expected in /var/tmp
, but OVAL will
check both.Bash remediation uses the
df
command to find out the partition where the home
directory is mounted. However, if the directory doesn't exist the remediation won't be
applied.Rationale
The presence of SUID and SGID executables should be tightly controlled. Users should not be able to execute SUID or SGID binaries from user home directory partitions.
- ID
- xccdf_org.ssgproject.content_rule_mount_option_home_nosuid
- Severity
- Medium
- References
- Updated
Remediation - Shell Script
# Remediation is applicable only in certain platforms
if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; then
function perform_remediation (){
mount_point_match_regexp="$(printf "^[[:space:]]*[^#].*[[:space:]]%s[[:space:]]" $1)"