Information
The PermitUserEnvironment option allows users to present environment options to the ssh daemon.
Permitting users the ability to set environment variables through the SSH daemon could potentially allow users to bypass security controls (e.g. setting an execution path that has ssh executing trojan'd programs)
Solution
Edit or create a file ending in *.conf in the /etc/ssh/sshd_config.d/ directory or the /etc/ssh/sshd_config file and set the PermitUserEnvironment parameter as follows:
PermitUserEnvironment no
Run the following command to comment out any PermitUserEnvironment parameter entries in files ending in *.conf in the /etc/ssh/sshd_config.d/ directory or the /etc/ssh/sshd_config file that include any setting other than no
# grep -Pi '^h*PermitUserEnvironmentb' /etc/ssh/sshd_config /etc/ssh/sshd_config.d/*.conf | grep -Evi 'no' | while read -r l_out; do sed -ri "/^s*PermitUserEnvironments+/s/^/# /" "$(awk -F: '{print $1}' <<< $l_out)";done