Vulnerability Discussion
Setting the kernel.perf_event_paranoid kernel parameter to "2" prevents attackers from gaining additional system information as a nonprivileged user.
Satisfies: SRG-OS-000132-GPOS-00067, SRG-OS-000138-GPOS-00069
Check
Verify AlmaLinux OS 9 is configured to prevent kernel profiling by nonprivileged users with the following commands:
Check the status of the kernel.perf_event_paranoid kernel parameter.
$ sysctl kernel.perf_event_paranoid
kernel.perf_event_paranoid = 2
If "kernel.perf_event_paranoid" is not set to "2" or is missing, this is a finding.
Check that the configuration files are present to enable this kernel parameter.
$ /usr/lib/systemd/systemd-sysctl --cat-config | egrep -v '^(#|;)' | grep -F kernel.perf_event_paranoid | tail -1
kernel.perf_event_paranoid = 2
If "kernel.perf_event_paranoid" is not set to "2" or is missing, this is a finding.
Fix
Configure AlmaLinux OS 9 to prevent kernel profiling by nonprivileged users with the following command:
$ echo "kernel.perf_event_paranoid = 2" > /etc/sysctl.d/60-perf.conf
Load settings from all system configuration files with the following command:
$ sysctl --system