Vulnerability Discussion
If the "sudoers" file is not configured correctly, any user defined on the system can initiate privileged actions on the target system.
Check
Verify AlmaLinux OS 9 restricts privilege elevation to authorized personnel with the following command:
$ grep -w ALL /etc/sudoers /etc/sudoers.d/* | grep -v '#'
/etc/sudoers:root ALL=(ALL) ALL
/etc/sudoers:%wheel ALL=(ALL) NOPASSWD: ALL
If the either of the following entries are returned, including their NOPASSWD equivalents, this is a finding:
ALL ALL=(ALL) ALL
ALL ALL=(ALL:ALL) ALL
Fix
Remove the following entries from the /etc/sudoers file or configuration files under /etc/sudoers.d/ (including NOPASSWD equivalents):
ALL ALL=(ALL) ALL
ALL ALL=(ALL:ALL) ALL