2025-02-11 16:40:50 +05:30
id : limit-ssh-users-access
info :
name : Limit SSH Users Access
author : pussycat0x
severity : unknown
description : |
Restricting SSH user access improves security by allowing only authorized users to connect, reducing the risk of unauthorized logins and potential attacks.
remediation : |
Restrict SSH access by configuring AllowUsers or AllowGroups in /etc/ssh/sshd_config and restart the SSH service.
reference :
- https://vishalraj82.medium.com/hardening-openssh-security-37f5d634015f
- https://cloud.ibm.com/docs/ssh-keys?topic=ssh-keys-granting-ssh-access-to-a-user
metadata :
verified : true
tags : audit,config,ssh,auth
javascript :
2025-02-17 21:22:51 +05:30
- pre-condition : |
isPortOpen(Host,Port);
code : |
2025-02-11 16:40:50 +05:30
var m = require("nuclei/ssh");
var c = m.SSHClient();
2025-02-17 21:22:51 +05:30
c.Connect(Host,Port,User,Pass);
2025-02-11 16:40:50 +05:30
const sshConfig = c.Run('cat /etc/ssh/sshd_config')
sshConfig
let result = "";
if (!sshConfig.includes('AllowUsers')){
result += "Limit SSH Users Access; ";
}
else{
exit();
}
result
args :
Host : "{{Host}}"
Port : "22"
2025-02-24 11:54:19 +05:30
User : "{{usernames}}"
Pass : "{{passwords}}"
2025-02-11 17:32:58 +05:30
2025-02-11 16:40:50 +05:30
matchers :
- type : dsl
dsl :
- "success == true"
2025-02-24 11:54:19 +05:30
2025-02-11 16:40:50 +05:30
extractors :
- type : dsl
dsl :
2025-02-24 06:41:49 +00:00
- response
# digest: 4b0a00483046022100e5ca1199361b834994bf2db56bfe92380bef7598ae6ef39791c04bf96be2f199022100a5c92bcfd2ffef3d361341ec13958ae565ee54727b0e0cec624b66c33e5a7ac7:922c64590222798bb761d5b6d8e72950