2025-03-28 11:14:21 -07:00
id : ssh-hostbasedauth-disabled
2025-06-12 17:43:35 +05:30
2025-03-28 11:14:21 -07:00
info :
2025-06-12 17:43:35 +05:30
name : Ensure SSH HostbasedAuthentication - Disabled
2025-03-28 11:14:21 -07:00
author : Th3l0newolf
2025-05-15 19:08:01 +05:30
severity : high
2025-03-28 11:14:21 -07:00
description : |
2025-06-12 17:43:35 +05:30
The HostbasedAuthentication parameter determines whether SSH authentication is permitted using trusted hosts, based on entries in .rhosts or /etc/hosts.equiv, in combination with successful public key authentication from the client host.
remediation : |
Edit /etc/ssh/sshd_config to set 'HostbasedAuthentication no' and restart SSH service with 'sudo systemctl restart sshd'.
2025-05-15 19:08:01 +05:30
reference :
- https://www.cisecurity.org/benchmark/ubuntu_linux
2025-06-12 17:43:35 +05:30
- https://docs.datadoghq.com/security/default_rules/def-000-fqw/
metadata :
verified : true
tags : cis,ssh,linux,audit,ubuntu,benchmark
2025-03-28 11:14:21 -07:00
self-contained : true
code :
- engine :
- bash
2025-06-12 17:43:35 +05:30
2025-03-28 11:14:21 -07:00
args :
- "-c"
- |
SSHD_CONFIG="/etc/ssh/sshd_config"
# Check if the parameter is set to yes (bad)
if grep -i '^\s*HostbasedAuthentication\s\+yes' "$SSHD_CONFIG" >/dev/null; then
current_value=$(grep -i '^\s*HostbasedAuthentication' "$SSHD_CONFIG" | head -1 | tr -d '\n')
echo "[cis-ssh-hostbasedauth-disabled:Policy-Fail] [$current_value] [CIS_FAIL] [medium]"
else
echo "[cis-ssh-hostbasedauth-disabled:Policy-Pass] [HostbasedAuthentication no or not set] [CIS_PASS] [medium]"
fi
matchers :
- type : word
2025-05-15 19:08:01 +05:30
name : policy-pass
2025-03-28 11:14:21 -07:00
words :
- "Policy-Pass"
2025-05-15 19:08:01 +05:30
2025-03-28 11:14:21 -07:00
- type : word
2025-06-11 23:43:25 +05:30
name : policy-fail
2025-03-28 11:14:21 -07:00
words :
- "Policy-Fail"
2025-06-13 06:55:29 +00:00
# digest: 490a00463044022013edf98f527f0171254a8ef0aafc2ac836f099ba47c7556913bc253e21a49878022072275743c7347b438d73fbc3b1b65b9498bea608ed176ab9925ba71139a92e2d:922c64590222798bb761d5b6d8e72950