psf-openssh-musl-check(8)
OpenSSH password authentication bypass on musl Linux without PAM: check, hunt
and a reversible mitigation (v1)
No CVE at time of writing (reported 5 November 2026 by Ozgun Kultekin of
Wakefield; advisories from Alpine Linux and the OpenSSH project the same day.
The README spells the name with its proper Turkish diacritics: Ozgun here is
ASCII only, because this comment becomes the manual page and groff's default
encoding cannot render them)
If this software is helpful, consider a donation to our 501c3 nonprofit:
https://privacysafe.foundation
When sshd is built against musl libc without PAM (or built with PAM but run
with UsePAM no), it checks a password itself: it hashes the attempt with
crypt() and compares the result to the account's stored field in /etc/shadow.
For an account whose stored field is too short to contain a salt, sshd
borrows another account's salt to hash the attempt, a fix for CVE-2016-6210
(timing-based user enumeration). musl's crypt() returns the literal string
"*" as an error indicator for a key (password) over 256 bytes; confirmed
against musl's own source and a real musl build for this release: a 256 byte
password hashes normally, a 257 byte one returns exactly "*". "*" is also
the stored field of every account with no password set, so a 257 to 1024
byte password makes the comparison match and the login succeeds, for any
account whose shadow field is "*", as long as some other local account has a
$5$ or $6$ password hash to lend its salt. An account locked with "!" is not
reachable this way: "!" cannot appear as a crypt() error return, so the
strings never match.
This needs ALL of: an sshd linked against musl, UsePAM no (Alpine's
openssh-server package is built this way by default; openssh-server-pam is
not, but is exposed too if UsePAM no is set), PasswordAuthentication yes
(OpenSSH's own default), an account whose shadow field is exactly "*" (root
on Alpine since about 3.16, a key-only user made with adduser and no
password or usermod -p '*', a directory-service user with no shadow entry,
or the "alpine" user that Alpine's official cloud images ship), and at least
one other local account with a $5$ or $6$ hash. On Alpine's own tiny-cloud
AWS and Azure images the "alpine" user has passwordless doas, so reaching it
reaches root even though OpenSSH's own PermitRootLogin default blocks root
directly. A system using PAM with UsePAM yes, or glibc, or any non-Linux
system, is not affected: the bug is in musl's crypt(), not in OpenSSH.
The fix is OpenSSH 10.6p2 (released 5 November 2026), which stops relying on
the comparison in sshd itself and is safe even on an unpatched musl. Alpine
has published fixed openssh packages for every release still receiving
updates and several that no longer do (3.16 through edge; see the README).
Until you can update: set PasswordAuthentication no, which closes this
entirely, on any libc.
"check" and "hunt" are read-only. "mitigate" and "rollback" are the only
commands that change anything. "check" finds sshd (PATH, the usual
locations, a running process), reads its ELF interpreter and dynamic
section to judge musl and PAM linkage without executing it, reads the
effective configuration with "sshd -T" and scans for a Match block that
re-enables PasswordAuthentication for specific connections even when the
global setting is "no" (verified: a Match block does exactly this, and a
drop-in alone would miss it), and reads /etc/shadow for the two kinds of
account the attack needs. It never executes sshd with attacker-controlled
input and never attempts a login.
Usage:
./openssh-musl-check.sh [command]
check (default) Read-only. Exit 0 = not affected or no account is
reachable this way, 1 = affected, 2 = it could not be
judged (sshd or /etc/shadow could not be read).
hunt Read-only. Reads the auth log (the journal's sshd
messages, and /var/log/auth.log, /var/log/secure and
/var/log/messages where they exist) for "Accepted
password" lines naming an account whose shadow field is
"*" right now. This can only check the account's CURRENT
field, not what it was at the time of a login in an old
log line. Exit 0 = nothing found, 1 = a lead, 2 = no log
could be read.
mitigate [--dry-run] [--restart] (root) changes the host. Sets
PasswordAuthentication no two ways, matching Alpine's own
advisory: writes a drop-in file in sshd_config's Include
directory when one exists, or the top of sshd_config
itself otherwise; and changes every other
"PasswordAuthentication ... yes" line already in
sshd_config to "no", including one inside a Match block,
because a Match block can re-enable it even under a
global "no" (this script confirmed that against a real
sshd). Every file it touches is copied first, the result
is checked with "sshd -t", and the originals are put back
at once if that check fails. Nothing is restarted unless
you add --restart: a mitigation that is written but not
yet loaded does not protect you.
rollback [--dry-run] [--restart] Puts back every file mitigate changed.
version Prints the script version.
Env overrides, mainly for testing:
SSHD_BIN the sshd binary to read, instead of discovery
SSHD_CONFIG the main sshd_config file (default /etc/ssh/sshd_config)
SSHD_CONFIG_D the Include directory (default /etc/ssh/sshd_config.d)
SHADOW_FILE instead of /etc/shadow
SSHD_T_OUTPUT a file whose content stands in for "sshd -T" (testing only)
SSHD_T_MATCH_OUTPUT a file whose content stands in for "sshd -T -C ..." per Match
block (testing only; see the script for the exact form)
OS_RELEASE_FILE instead of /etc/os-release
APT_PKG_VERSION, APK_PKG_VERSION the installed package version, instead of apk/dpkg
HUNT_LOG_FILES the log files hunt reads, instead of the defaults
STATE_DIR where mitigate keeps its backups and manifest
(default /var/lib/psf-security-patches/openssh-musl)
PSF_LOCK_WAIT seconds a run that changes the host waits for another
one that is already changing it (default 30)The Security Patches software and this documentation are dedicated to the public domain under CC0 1.0 Universal. Other pages on privacysafe.app/docs are CC BY-SA 4.0 unless the page says otherwise.