SSH Key-Based Authentication - Disabled

漏洞信息

漏洞名称: SSH Key-Based Authentication - Disabled

漏洞类型: 配置问题

漏洞等级: 低危

漏洞描述: 该漏洞涉及SSH(Secure Shell)服务,SSH是一种广泛使用的网络协议,用于安全地访问远程服务器。它通常部署在企业环境、云服务器和个人开发环境中,是管理远程系统的标准工具。SSH密钥认证被禁用,允许基于密码的登录,这增加了暴力破解攻击和未授权访问的风险。漏洞的技术根源在于SSH服务的配置文件中未正确设置PasswordAuthentication no,导致系统允许使用密码进行认证,而不是强制使用更安全的密钥认证。这种配置问题使得攻击者可能通过暴力破解或其他手段获取合法用户的密码,从而获得未授权访问权限。尽管该漏洞的严重性被评估为低危,但它仍然可能导致敏感信息泄露或系统被入侵,尤其是在没有实施强密码策略或账户锁定机制的环境中。修复建议包括启用SSH密钥认证,并将公钥添加到~/.ssh/authorized_keys文件中,同时在/etc/ssh/sshd_config配置文件中禁用密码认证(设置PasswordAuthentication no)。

产品名称: SSH

来源: https://github.com/projectdiscovery/nuclei-templates/blob/804d1df949d5fbbfdee11564a2df65b6836a8d60/javascript%2Faudit%2Fssh%2Fssh-key-auth-disabled.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: ssh-key-auth-disabled

info:
name: SSH Key-Based Authentication - Disabled
author: pussycat0x
severity: low
description: |
SSH key-based authentication is disabled, allowing password-based logins, which increases the risk of brute-force attacks and unauthorized access.
remediation: |
Enable SSH key-based authentication by adding the public key to ~/.ssh/authorized_keys and disabling password authentication in /etc/ssh/sshd_config (PasswordAuthentication no).
reference:
- https://vishalraj82.medium.com/hardening-openssh-security-37f5d634015f
- https://www.digitalocean.com/community/tutorials/how-to-configure-ssh-key-based-authentication-on-a-linux-server
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('#PasswordAuthentication yes') && !sshConfig.includes('PasswordAuthentication yes')){
result += "SSH Key-Based Authentication Disabled";
}
else{
exit();
}
result

args:
Host: "{{Host}}"
Port: "22"
User: "{{usernames}}"
Pass: "{{passwords}}"

matchers:
- type: dsl
dsl:
- "success == true"

extractors:
- type: dsl
dsl:
- response
# digest: 4b0a00483046022100e74a6f1240b37c11e994a870993eda924e977fde4ca97ad003f6350c14e4eefe022100d2ccd197706d61fcf871d63bccc809641c470f082b10c3f75dd3e6ee9cd3fd93:922c64590222798bb761d5b6d8e72950


SSH Key-Based Authentication - Disabled
http://example.com/2025/07/27/github_753819889/
作者
lianccc
发布于
2025年7月27日
许可协议