SSH 空密码禁用漏洞

漏洞信息

漏洞名称: SSH 空密码禁用漏洞

漏洞类型: 弱口令

漏洞等级: 高危

漏洞描述: SSH(Secure Shell)是一种广泛使用的网络协议,用于安全地访问远程服务器。它通常部署在企业环境、云服务器和个人设备上,用于远程管理和文件传输。SSH的空密码漏洞允许攻击者在没有密码的情况下直接登录系统,这极大地增加了系统被未授权访问的风险。该漏洞的根源在于SSH配置文件中未正确设置PermitEmptyPasswords参数为no,导致系统允许空密码登录。这种配置问题可能由于管理员疏忽或默认配置不当引起。利用此漏洞,攻击者可以无需任何认证即可登录系统,进而执行任意命令、窃取敏感数据或部署恶意软件。由于SSH服务通常直接暴露在互联网上,这种漏洞尤其危险,可以被自动化工具大规模扫描和利用。为了防止此类攻击,管理员应确保在所有SSH服务器上禁用空密码登录,并定期检查配置文件的安全性。

产品名称: SSH

来源: https://github.com/projectdiscovery/nuclei-templates/blob/804d1df949d5fbbfdee11564a2df65b6836a8d60/javascript%2Faudit%2Fssh%2Fdisable-empty-password.yaml

类型: projectdiscovery/nuclei-templates:github issues

POC详情

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53

id: disable-empty-password

info:
name: Disable SSH Empty Password
author: pussycat0x
severity: high
description: |
Allowing empty passwords in SSH poses a severe security risk, enabling unauthorized access, brute-force attacks, and potential system compromise. It should always be disabled to prevent unauthorized logins.
remediation: |
Set PermitEmptyPasswords no in /etc/ssh/sshd_config to disable empty password logins and restart the SSH service.
reference:
- https://vishalraj82.medium.com/hardening-openssh-security-37f5d634015f
- https://docs.datadoghq.com/security/default_rules/xccdf-org-ssgproject-content-rule-sshd-disable-empty-passwords/
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('PermitEmptyPasswords yes')) {
result += "Disable SSH Empty Password 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: 4b0a0048304602210090f1b075340725c5e0a63dc65dabe176c1185bccf08e593976fd35572de9100802210093ed51e2c2f2b957243fb609c5c987ec849446151f7e846ca72cb7b91a89a01f:922c64590222798bb761d5b6d8e72950


SSH 空密码禁用漏洞
http://example.com/2025/07/27/github_3322923583/
作者
lianccc
发布于
2025年7月27日
许可协议