Files
nuclei-templates/javascript/audit/ssh/limit-ssh-group.yaml
2025-02-24 06:41:50 +00:00

51 lines
1.5 KiB
YAML

id: limit-ssh-group
info:
name: Limit SSH Users Group Access
author: pussycat0x
severity: unknown
description: |
Limiting SSH user group access enhances security by restricting login permissions to authorized groups, reducing the attack surface and preventing unauthorized access.
remediation: |
Ensure only necessary users are listed in AllowUsers within /etc/ssh/sshd_config, then 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:
- 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('AllowGroups')){
result += "Limit SSH Users Group Access; ";
}
else{
exit();
}
result
args:
Host: "{{Host}}"
Port: "22"
User: "{{usernames}}"
Pass: "{{passwords}}"
matchers:
- type: dsl
dsl:
- "success == true"
extractors:
- type: dsl
dsl:
- response
# digest: 490a0046304402200f92b3878984629518e1273af1410e7c952b53692df85e4e4fbecbe535b18043022062c92bfc1503feff994ca2314293fc1c6457ef6c605d384c96dd56ac0860f149:922c64590222798bb761d5b6d8e72950