NFS2ROOT: A Decade Old Linux Vulnerability CVE-2026-99362 · 14h CISA KEV Weekly Briefing – Week 48 · 1d Suspected Vietnam-Linked Hackers Target Southeast Asia in South China Sea Espionage Campaign · 2d Vulnerability in GNU m4 software · 2d Vulnerability in SMSEagle RCDevs OpenOTP SMS integration connector software · 2d Fragnesia: When a Firewall Becomes the Target · 3d Vulnerability in Chainlit software · 3d Vulnerabilities in GNU Screen software · 3d Drupal Warns of New Highly Critical Site Takeover Vulnerability Under Active Exploitation · 3d Hackers Exploit 10 Vulnerabilities Across Mitel, Juniper, Vates, and Danfoss Products · 3d NFS2ROOT: A Decade Old Linux Vulnerability CVE-2026-99362 · 14h CISA KEV Weekly Briefing – Week 48 · 1d Suspected Vietnam-Linked Hackers Target Southeast Asia in South China Sea Espionage Campaign · 2d Vulnerability in GNU m4 software · 2d Vulnerability in SMSEagle RCDevs OpenOTP SMS integration connector software · 2d Fragnesia: When a Firewall Becomes the Target · 3d Vulnerability in Chainlit software · 3d Vulnerabilities in GNU Screen software · 3d Drupal Warns of New Highly Critical Site Takeover Vulnerability Under Active Exploitation · 3d Hackers Exploit 10 Vulnerabilities Across Mitel, Juniper, Vates, and Danfoss Products · 3d
🛡️
ACyber Sentinel 安全评估团队
← 返回
⚡ 情报报告

OpenSSH 发布紧急修复,修复允许长密码绕过 Alpine Linux 上 SSH 认证的漏洞

攻击者可以在某些运行标准 openssh-server 包的 Alpine Linux 服务器上登录没有密码的账户,例如仅使用 SSH 密钥的账户。他们需要对服务器的网络访问、一个账户名以及一个长度在 257 到 1,024 字节之间的密码。

OpenSSH 认为该漏洞是严重的,今天发布了 10.6p2 版本以阻止该漏洞。Alpine 已为每个版本发布了修复包,最早可追溯到 3.16。

当 OpenSSH 服务器 (sshd) 在没有可插拔认证模块 (PAM) 接口的情况下检查密码时,如果启用了密码登录,并且机器上至少有一个其他账户有密码,该攻击就会生效。Alpine 的 openssh-server 包是没有 PAM 构建的,并且默认启用密码登录。

该漏洞源于 sshd 如何与 musl(Alpine 构建的 C 库)协同工作。OpenSSH 项目的 Damien Miller 表示,非 Linux 系统、基于 glibc 构建的 Linux 系统以及通过 PAM 检查密码的系统不受影响。

他告诉任何运行受影响系统的人要“立即设置 PasswordAuthentication=no 或禁用这些系统的 SSH。”目前尚未报告利用该漏洞的攻击。

谁受到影响

Alpine 的安全公告列出了四个条件。当所有四个条件都为真时,服务器就会受到影响:

它运行 openssh-server 包,该包是没有 PAM 构建的,或者运行 openssh-server-pam 并且 UsePAM 设置为 no。

PasswordAuthentication 设置为 yes,这是 OpenSSH 的默认值。

一个账户的密码字段为 *,这意味着没有设置密码。

至少有一个其他本地账户的密码哈希以 $5$ 或 $6$ 开头。

攻击者还需要一个没有密码的账户名。一个有密码的账户足以暴露每个没有密码的账户。根据公告,该攻击在每次尝试中都能成功,只需一个连接。

在 Alpine 中,没有设置密码的账户包括:

通过 adduser 创建的仅使用密钥的用户,没有密码,或使用 usermod -p '*'。

通过 musl-nscd 从目录服务中来的用户,因为他们没有阴影条目。

root,自大约 Alpine 3.16 以来以 root:* 的形式包含在基础镜像中。

在官方云镜像中,使用 tiny-cloud 构建的 alpine 用户。

root 受到默认 PermitRootLogin prohibit-password 设置的保护,只有在设置 PermitRootLogin yes 时才能直接访问。如果一个暴露的账户可以成为 root,例如通过 doas,那么这种保护就无效。

从 3.18.11 到 3.24.3 的 tiny-cloud 镜像为 alpine 用户提供了无密码的 doas。它们在首次启动时是安全的,但一旦机器上存在任何 $6$ 哈希,例如在管理员设置控制台密码后,就会变得容易受到攻击。攻击者随后可以以 alpine 身份登录并使用 doas 成为 root。

不运行 sshd 的容器、PasswordAuthentication 设置为 no 的系统以及通过 cloud-init 设置的云镜像(该设置会写入)不受影响。/etc/shadow 中用 ! 锁定的账户也不受影响,且没有账户具有 $-style 密码哈希的机器也不受影响。

该漏洞并不限于 Alpine。报告此漏洞的 Özgün Kültekin 指出,OpenWrt、Buildroot 和 Yocto 是其他需要检查的基于 musl 的系统。

OpenWrt 默认使用 Dropbear 处理 SSH,正如其 Dropbear 文档所示,Kültekin 表示 Dropbear 不受影响。在 OpenWrt 中,该漏洞只有在管理员安装了 OpenSSH 服务器时才会产生影响。

如何修复

在 Alpine 中,修复方法是更新包并重启,因为升级包不会重启正在运行的 sshd:

更新包:apk upgrade -U -a

重启服务器:rc-service sshd restart

版本 3.21.10、3.22.8、3.23.8 和 3.24.4 已包含修复包。3.16 到 3.21 的分支已过支持结束,但也获得了修复包。

从早于这些点版本的 tiny-cloud 镜像启动的云实例仍然需要更新,或需要设置如下。

如果您自己构建 OpenSSH,版本 10.6p2 包含该更改,正如其发布说明所描述的。

如果您尚无法更新,关闭密码登录也可以阻止攻击。首先确保您的 SSH 密钥登录正常工作,并在新的登录成功之前保持当前会话打开。然后设置 PasswordAuthentication no,使用 sshd -t 检查配置,并重启 sshd。

公告提供了在 /etc/ssh/sshd_config.d 中的 drop-in 文件中添加该设置的命令,Alpine 的默认配置从 3.19 开始读取它们。它们还将 /etc/ssh/sshd_config 中的每一行 PasswordAuthentication 从 yes 更改为 no,包括 Match 块内的行。之后,sshd -T | grep -i passwordauthentication 应该打印 passwordauthentication no。

公告建议查看 /var/log/messages 中的 sshd 行,查找接受没有密码的账户(如 alpine、root 或仅使用密钥的用户)的密码的记录。在暴露的机器上,还应检查 doas 使用情况、最近创建的用户、文件和授权密钥。

“如果您无法排除登录,请将该机器视为已被攻陷,”公告中写道。

为什么长密码有效

在没有 PAM 的情况下,sshd 自行检查密码。它使用 crypt() 函数对尝试进行哈希,该函数将密码转换为其存储形式,并将结果与存储字段进行比较。

没有密码的账户在该字段中只有 *。这太短,无法存储盐,即哈希的随机前缀,因此 sshd 借用另一个具有真实哈希的账户的盐。

对于 $5$ 和 $6$ 哈希类型,musl 的 crypt() 拒绝长度超过 256 字节的密码,并返回 * 以指示错误。该 * 与存储的 * 匹配,因此 sshd 接受登录。范围的上限是 sshd 自身的每个密码 1,024 字节的限制。

这种行为源于 2012 年 8 月 9 日的 musl 更改,该更改使得失败的 crypt() 调用返回“一个无法匹配的哈希而不是 NULL”,因为许多程序没有检查失败。256 字节的限制于 2012 年 8 月 29 日实施,以保护服务器免受拒绝服务攻击。

盐的借用源于 2016 年 7 月 15 日的 OpenSSH 更改,该更改解决了

相关漏洞

CVE-2016-6210 CVSS 5.9 MEDIUM Modified
CVE-2016-6210 - OpenSSH sshd Password Hashing Timing Vulnerability
sshd in OpenSSH before 7.3, when SHA256 or SHA512 are used for user password hashing, uses BLOWFISH hashing on a static password when the username does not exist, which allows remote attackers to enumerate users by leveraging the timing difference between responses when a large password is provided.