RHEL 9 must mount /dev/shm with the noexec option.

STIG ID: RHEL-09-231115  |  SRG: SRG-OS-000368-GPOS-00154 |  Severity: medium (CAT II)  |  CCI: CCI-001764 |  Vulnerability Id: V-257864

Vulnerability Discussion

The "noexec" mount option causes the system to not execute binary files. This option must be used for mounting any file system not containing approved binary files, as they may be incompatible. Executing files from untrusted file systems increases the opportunity for nonprivileged users to attain unauthorized administrative access.

Check

Verify "/dev/shm" is mounted with the "noexec" option with the following command:

$ findmnt /dev/shm

/dev/shm tmpfs tmpfs rw,nodev,nosuid,noexec,seclabel

If the mount options for /dev/shm does not include noexec, this is a finding.

Fix

Configure "/dev/shm" to mount with the "noexec" option.

Modify "/etc/fstab" to use the "noexec" option on the "/dev/shm" file system.

To reload all implicit mount units and update the dependency graph so that new options will apply correctly at next remount, run the following command:

$ sudo systemctl daemon-reload

Use the following command to apply the changes immediately without a reboot:

$ sudo mount -o remount /dev/shm