info: name: Unrestricted SSH Access from Non-Whitelisted IPs author: pussycat0x severity: unknown description: | SSH access is not restricted to specific IP addresses, allowing connections from any source. This increases the risk of unauthorized access and brute-force attacks. remediation: | Restrict SSH to specific IPs in/etc/ssh/sshd_config by setting ListenAddress <trusted-IP> and restarting the SSH service. reference: - https://vishalraj82.medium.com/hardening-openssh-security-37f5d634015f - https://www.cyberciti.biz/tips/howto-openssh-sshd-listen-multiple-ip-address.html metadata: verified:true tags: audit,config,ssh,auth
javascript: -pre-condition: | isPortOpen(Host,Port); code: | var m = require("nuclei/ssh"); var c = m.SSHClient(); c.Connect(Host,Port,User,Pass); const sshConfig = c.Run('cat /etc/ssh/sshd_config') sshConfig let result =""; if (sshConfig.includes('#ListenAddress') && !sshConfig.includes('ListenAddress ')){ result +="SSH access restriction not enforced"; } else{ exit(); } result