
OpenSSH + musl password authentication bypass (sshole) checker: local precondition audit + remote verification; for authorized testing
Targeting CVE-2026-123158 (community name "sshole") — an OpenSSH + musl password authentication bypass: on musl systems without PAM, accounts whose password field is * (no password set) can be logged into with a password of any length from 257 to 1024 bytes.
ID: CVE-2026-123158 (CVSS 3.1 8.1); OpenSSH has already fixed it in 10.6p2 (2026-11-05) as a "critical security bypass (workaround)".
This repository provides a Python script for:
/etc/shadow);paramiko).In one sentence: two "never match" sentinel values collided in the same string comparison forty years later.
| Time | Event |
|---|---|
| 1980 | Unix used * to mean "this account has no password and can never log in" (first used by Bill Joy for the daemon account in 3BSD), stored in /etc/passwd |
| 1997 | POSIX specified that crypt() returns NULL on failure; but many programs do not check for NULL |
| 2012-08-09 | musl changed to returning "*" on failure (to prevent callers from crashing) — overlapping with the 1980 sentinel value |
| 2012-08-29 | musl added a 256-byte upper limit to sha512crypt (to prevent DoS); overlong passwords → crypt() fails → returns "*" |
| 2016-07 | OpenSSH fixed CVE-2016-6210 (username enumeration), making sshd borrow another account's salt to hash for accounts that "have no real hash" |
| 2019 → 2022 | Alpine's root changed from ! to * (! would also disable SSH key login) |
| 2026-11 | The two sentinels meet: the returned "*" compares equal to the stored "*" → authentication succeeds |
① 攻击者用超长密码(257–1024 字节)尝试登录账户 X(X 的 shadow 字段是 "*")
② sshd(无 PAM)调用 sys_auth_passwd(),拿到的 pw_password == "*"
③ "*" 不能当 salt 用 → sshd 借用另一个账户的 $5$/$6$ salt(2016 年的改动)
④ sshd 调 crypt(password, salt)
⑤ musl:密码 > 256 字节 → 拒绝 → 返回 "*"
⑥ sshd 比较:crypt 返回 "*" == 存储字段 "*" → 相同 → 登录成功
The fix (10.6p2, commit 90f9c2f7) only added one line before the comparison:
ret = encrypted_password != NULL &&
strlen(pw_password) >= MIN_PASSWORD_HASH_LEN && /* MIN_PASSWORD_HASH_LEN = 4 */
strcmp(encrypted_password, pw_password) == 0;
When the stored field is only 1 byte (*), it is directly judged as a mismatch.
openssh-server (compiled without PAM), or openssh-server-pam but with UsePAM no;PasswordAuthentication yes (OpenSSH default);*;$5$ or $6$ hash.Not affected: non-Linux, glibc systems, sshd using PAM, PasswordAuthentication no, accounts locked with !, machines without $-style hashes, containers not running sshd.
On Alpine, * accounts include: key-based users created with adduser without a password, usermod -p '*', directory service users via musl-nscd, and root, which the base image has shipped as root:* since 3.16 (protected by the default PermitRootLogin prohibit-password unless changed to yes; however, if that account can escalate privileges via doas, the protection is defeated).
# 1) 本地体检(需要 root 读 /etc/shadow)
sudo python3 ssh_star_bypass.py --local
# 2) 远程验证(需要 paramiko)
python3 -m pip install paramiko
python3 ssh_star_bypass.py -t 10.0.0.5 -u alpine
python3 ssh_star_bypass.py -t 10.0.0.5 -u alpine -l 512 -p 22
Parameters: -t/--target, -p/--port, -u/--user, -l/--length (257–1024, default 300), --timeout.
Remote mode first performs a control (a 16-byte wrong password, expected to be rejected), then sends a long password. This distinguishes "there really is a vulnerability" from "this account already has a password".
Exit codes: 0 present/exploitable; 1 not hit; 2 cannot determine (missing dependency/permission/network).
crypt() to fail directly, so there is no need to know the correct password, and no brute-forcing is needed;apk upgrade -U -a # Alpine 3.21.10 / 3.22.8 / 3.23.8 / 3.24.4 起含修复包
rc-service sshd restart # 升级不会重启运行中的 sshd,必须手动重启
Self-compile: upgrade to OpenSSH 10.6p2. If upgrading is not possible: set PasswordAuthentication no and restart sshd (first confirm key login works and keep the current session).
# 是否有"本来没密码的账户"被密码登录过
grep -E "Accepted password for" /var/log/messages
Focus on alpine, root, and the dedicated key account; also review doas usage records, recently created users, and changes to files and authorized_keys. Official recommendation: if you cannot rule out that a login occurred, treat it as compromised.
For security research and defensive validation only in environments you own or are explicitly authorized to test. Do not use against unauthorized systems; the script will generate real authentication failure/success logs on the target.
Mechanism descriptions reference: public analysis by researcher Özgün Kültekin (Wakefield), Alpine security advisories, and the OpenSSH 10.6p2 release notes.