RHEL 9 must not allow users to override SSH environment variables.

STIG ID: RHEL-09-255085  |  SRG: SRG-OS-000480-GPOS-00229 | Severity: medium |  CCI: CCI-000366

Vulnerability Discussion

SSH environment options potentially allow users to bypass access restriction in some configurations.

Check

Verify that unattended or automatic logon via SSH is disabled with the following command:

$ sudo grep -ir permituserenvironment /etc/ssh/sshd_config /etc/ssh/sshd_config.d/*

PermitUserEnvironment no

If "PermitUserEnvironment" is set to "yes", is missing completely, or is commented out, this is a finding.

If the required value is not set, this is a finding.

Fix

Configure the RHEL 9 SSH daemon to not allow unattended or automatic logon to the system.

Add or edit the following line in the "/etc/ssh/sshd_config" file:

PermitUserEnvironment no

Restart the SSH daemon for the setting to take effect:

$ sudo systemctl restart sshd.service