Profile Applicability:
• Level 1
Description:
The nosuid mount option prevents the operation of set-user-identifier (setuid) and set-group-identifier (setgid) bits on executable files in the mounted filesystem. Applying this option to /var/tmp helps mitigate privilege escalation by disallowing setuid and setgid programs from running in this temporary directory.
Rationale:
Setting the nosuid option on /var/tmp reduces the risk that attackers could exploit setuid/setgid binaries within /var/tmp to gain elevated privileges.
Impact:
Pros:
Helps prevent privilege escalation attacks via setuid/setgid binaries in /var/tmp.
Improves overall system security.
Cons:
May affect applications relying on setuid/setgid binaries in /var/tmp (rare).
Default Value:
The nosuid option is typically not set on /var/tmp unless explicitly configured.
Pre-requisites:
Root or sudo privileges to modify /etc/fstab and remount filesystems.
/var/tmp must be mounted as a separate partition.
Remediation:
Test Plan:
Using Linux command line:
Check current mount options for /var/tmp:
mount | grep /var/tmp
Verify if nosuid is included in /etc/fstab for /var/tmp:
grep /var/tmp /etc/fstab
Expected output: Mount options for /var/tmp include nosuid.
Implementation Plan:
Using Linux command line:
- Edit /etc/fstab to add nosuid to /var/tmp mount options. Example:
/dev/<partition> /var/tmp ext4 defaults,nodev,nosuid,noexec 0 0
Remount /var/tmp with new options:
mount -o remount,nosuid /var/tmp
Verify mount options:
mount | grep /var/tmp
Backout Plan:
Using Linux command line:
Remove nosuid from /var/tmp mount options in /etc/fstab.
Remount /var/tmp without nosuid:
mount -o remount /var/tmp
Verify mount options:
mount | grep /var/tmp
References:
CIS Amazon Linux 2 Benchmark v3.0.0