
Read-only POSIX sh audit for CVE-2026-123158: OpenSSH password authentication bypass on musl libc without PAM (Alpine Linux)
Read-only audit for CVE-2026-123158 ("sshole"): an OpenSSH sshd password
authentication bypass on musl libc without PAM. Alpine Linux is the main
example; Yocto, OpenWrt, Void (musl) and Wolfi are in the same situation.
Written in POSIX sh, so it runs as is on Alpine's busybox ash (no
apk add bash), on dash and on bash. It never runs an exploit and never prints
a password hash.
It also prints a short basic SSH hardening report (empty-password accounts, root login, weak algorithms, file permissions). That section is informational and never changes the CVE verdict or the exit code.
sshd without PAM checks a password with crypt() and compares the result with
the shadow password field. musl's crypt() returns * as its error value for
keys longer than 256 bytes, and * is exactly what an account with no password
stores. When the stored field is too short to carry a salt, sshd borrows the
salt of another account, the computed value equals the stored *, and the login
succeeds. On affected setups any password of 257 to 1024 bytes works for such
an account. Fixed upstream in OpenSSH 10.6p2.
| # | Precondition | Typical case |
|---|---|---|
| 1 | sshd without PAM | openssh-server, or openssh-server-pam with UsePAM no (the Alpine default) |
| 2 | PasswordAuthentication yes | the OpenSSH default |
| 3 | an account with * as password field | root on Alpine 3.16+, key-only users, the alpine user of tiny-cloud images |
| 4 | an account with a $... hash | an admin set a password for someone |
| 5 | the SSH port is reachable |
Not affected: containers without sshd, PasswordAuthentication no,
UsePAM yes with a PAM build, systems where no account has a $ hash.
# review it first, then run as root (sshd -T and /etc/shadow need root)
wget -O cve-2026-123158-audit.sh https://raw.githubusercontent.com/Quaerendir/cve-2026-123158-audit/main/cve-2026-123158-audit.sh
less cve-2026-123158-audit.sh
sh cve-2026-123158-audit.sh # text report
sh cve-2026-123158-audit.sh --json # JSON on stdout
sh cve-2026-123158-audit.sh --quiet # only the verdict word, plus the exit code
sh cve-2026-123158-audit.sh --no-hunt # skip the log grep
sh cve-2026-123158-audit.sh --no-banner # text report without the ASCII banner
sh cve-2026-123158-audit.sh --version
Without root the result is UNKNOWN unless the package is already fixed and
the daemon is current.
| exit | verdict | meaning |
|---|---|---|
| 0 | PATCHED | fixed package and a daemon that runs it |
| 0 | NOT_APPLICABLE | not a musl system, or no sshd installed or running |
| 1 | MITIGATED | unfixed code, but no reachable entry path right now. Still patch |
| 2 | VULNERABLE | exposed, or indicators of exploitation found in the logs |
| 3 | UNKNOWN | cannot decide (not root, odd package version). Treat as suspect |
| 4 | usage error or missing basic tools |
Same scheme as the other audits in this family (cve-2026-99999-audit and
others): 0 clear, 1 mitigated, 2 vulnerable, 3 unknown, 4 error.
Read from the effective sshd -T output and a few file modes. Each line is
[FAIL], [WARN] or [ ok ], with a summary count. They do not change the
verdict or the exit code, so scripts that rely on exit codes 0 to 4 behave as
before. In --json they appear as hardening_fail, hardening_warn and a
hardening array of "LEVEL: text" strings; empty_password_account_names
lists the accounts.
| Check | Level |
|---|---|
PermitRootLogin yes | FAIL |
PermitEmptyPasswords yes | FAIL |
| accounts with an empty password field, listed by name | FAIL if PermitEmptyPasswords yes (reachable over SSH), otherwise WARN (usable at a console or with su) |
StrictModes no, PermitUserEnvironment yes, HostbasedAuthentication yes | FAIL |
| host private key readable by group or other | FAIL |
/etc/ssh/sshd_config writable by group or other, or (on a real root) not owned by root | FAIL |
PasswordAuthentication yes | WARN |
KbdInteractiveAuthentication yes together with UsePAM yes | WARN |
MaxAuthTries above 6 | WARN |
X11Forwarding yes | WARN |
| weak ciphers (CBC, arcfour, blowfish, cast128), MACs (MD5, SHA-1, umac-64), key exchange (SHA-1), SHA-1 or DSA host and user key algorithms | WARN, with the entries named |
Note that OpenSSH's default MAC list still contains hmac-sha1 and
umac-64, so a stock Alpine install reports weak MACs. That is real, but a
common and low-severity finding.
Not covered: Match blocks (global values only), AllowUsers/AllowGroups,
crypto policy beyond the weak-entry patterns, authorized_keys contents, SSH
exposure and firewalling.
apk upgrade -U -a
rc-service sshd restart # the upgrade does NOT replace the running daemon
Fixed openssh builds (from OSV ALPINE-CVE-2026-123158):
| Alpine | fixed build | Alpine | fixed build |
|---|---|---|---|
| edge | 10.6_p2-r0 | 3.19 | 9.6_p1-r3 |
| 3.24 | 10.3_p1-r2 | 3.18 | 9.3_p2-r4 |
| 3.23 | 10.2_p1-r1 | 3.17 | 9.1_p1-r7 |
| 3.22 | 10.0_p1-r11 | 3.16 | 9.0_p1-r6 |
| 3.21 | 9.9_p2-r1 | 3.20 | 9.7_p1-r6 |
If you cannot update now, set PasswordAuthentication no (check with
sshd -T | grep -i passwordauthentication) and test key login in a second
session before closing the first.
sshd binary is asked from
apk, and its version is compared with the fixed build of its own upstream
series (so a package from another branch is judged correctly). sshd -V is
deliberately not used on Alpine: fixes are backported, and 10.0_p1-r11
still prints OpenSSH_10.0p2. A series that is not in the table is
UNKNOWN, one older than any fixed release (before 9.0) is unfixed.sshd -V can be used.
10.6p2 or newer is PATCHED. Anything lower cannot be proven unfixed, because
a distribution may have backported the fix, and the report says so./proc/PID/exe points to a deleted
file, the daemon still runs the old code, and the host is judged as unfixed.sshd -T prints no usepam key when the build has no PAM. With a PAM
build, UsePAM yes is a mitigation, UsePAM no is not./etc/shadow: *, $..., !, empty. Only the
names of * accounts are shown, never hashes.Accepted password for <account with *> in /var/log/messages,
auth.log, secure or syslog. An account with no password cannot log in
with a password legitimately, so a hit means exploitation. It forces
VULNERABLE even on a patched host, because that host needs incident
response, not just a patch.