mirror of
https://github.com/projectdiscovery/nuclei-templates.git
synced 2026-02-02 08:43:27 +08:00
51 lines
1.5 KiB
YAML
51 lines
1.5 KiB
YAML
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:
|
|
- 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('AllowUsers')){
|
|
result += "Limit SSH Users 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: 4b0a00483046022100e5ca1199361b834994bf2db56bfe92380bef7598ae6ef39791c04bf96be2f199022100a5c92bcfd2ffef3d361341ec13958ae565ee54727b0e0cec624b66c33e5a7ac7:922c64590222798bb761d5b6d8e72950 |