Type
Analysis
Published
Reading time
4 min read
Author
Lire en français
Lire en français →

OpenSSH on musl: when a crypt() error becomes a valid password

On some musl systems without PAM, a crypt() error equals the stored marker for passwordless accounts. OpenSSH 10.6p2 blocks the bypass.

Analysis of public sources

Read the article

OpenSSH 10.6p2 was released on 5 November 2026; the flaw is now CVE-2026-123158. On some Linux systems using musl with PAM disabled, a remote client can log in to an account whose password field is * without knowing a password. Several exact conditions are required: password authentication must be enabled, another local account must have a $5$ or $6$ hash, and the attempted password must contain between 257 and 1,024 bytes. Alpine Linux says one connection is enough when those conditions meet.

The defect involves neither a stolen SSH key nor an account configured with an empty password. Two components assign different meanings to the same text *: the account database uses it to mean “no usable password”, while crypt() uses it as an error value.

Equality is true for opposite reasons

Without PAM, sshd verifies a password by calling crypt() with the proposed password and a salt derived from the stored hash, then compares the result with the account’s password field. When an account contains only *, that value is too short to supply a salt. OpenSSH borrows a salt from another account to keep comparison timing similar and avoid revealing account state too easily.

On musl, a password longer than 256 bytes makes crypt() fail and return the string *. The resulting comparison becomes:

stored value for an account with no password: *
error value returned by crypt()               : *
comparison                                    : equal

The code intended to compare a calculated hash with a stored hash. It instead compares an error marker with a lock marker. OpenSSH describes 10.6p2 as a critical security fix for Linux musl systems running without PAM, while considering the root cause outside sshd. The project still blocks exploitation at the point where it would become successful authentication.

The upstream change makes that defence inspectable. OpenSSH defines a minimum hash length of four characters and rejects equality when the stored field is shorter. Comparison with * can no longer succeed even if crypt() still returns *:

ret = encrypted_password != NULL &&
    strlen(pw_password) >= MIN_PASSWORD_HASH_LEN &&
    strcmp(encrypted_password, pw_password) == 0;

This excerpt explains the fix; it does not independently prove that a distribution package contains the backport. Check the distribution version and patch, then restart the daemon.

Key-only accounts are at the centre of the issue

A * field is common for an account that may log in with a public key but never with a password. It is normally different from an empty password. Alpine cites accounts created without a password, some directory-service accounts and the alpine user in older tiny-cloud images.

Condition Effect in the chain
musl and no PAM, or UsePAM no Direct crypt() path is used
PasswordAuthentication yes Server accepts a password attempt
target account has a * field Stored value matches the error marker
another account has a $5$ or $6$ hash Compatible salt is available
password is 257 to 1,024 bytes musl crypt() returns *

Alpine’s root account is protected by default through PermitRootLogin prohibit-password. That does not protect another user allowed to open a session, especially one with a later path through doas or another administrative mechanism. A container that runs no sshd is not exposed through this interface.

Establish exposure without attempting a login

A remote reproduction is unnecessary to classify a machine. On an authorised host, an audit can establish the C library, effective sshd configuration and the two account forms separately. These commands never print complete hashes:

ldd --version 2>&1 | head -n 1
sshd -T | grep -Ei '^(usepam|passwordauthentication|permitrootlogin) '
sudo awk -F: '$2 == "*" { print "account with * marker:", $1 }' /etc/shadow
sudo awk -F: '$2 ~ /^\$(5|6)\$/ { found=1 } END { print found ? "SHA-crypt hash present" : "no SHA-crypt hash found" }' /etc/shadow

sshd -T renders effective configuration, including includes, but a Match block can change the result for a particular user or address. In that case, evaluate sshd -T -C user=<user>,host=<host>,addr=<address> with real values. The presence of all conditions classifies exposure; it does not show that a login occurred.

Updating does not restart the daemon

Alpine asks users to install the fixed package and restart sshd. A process keeps the old binary code after a package is replaced on disk. OpenSSH 10.6p2 contains the mitigation; Alpine also backported it across maintained and several older branches. tiny-cloud images rebuilt from 3.21.10, 3.22.8, 3.23.8 and 3.24.4 contain the fixed package, while instances created earlier need remediation in place.

If an immediate update is impossible, PasswordAuthentication no followed by an sshd restart removes the vulnerable path. Changing the * field without understanding account usage can break key or directory access; the vendor does not recommend that as a general mitigation.

To look for abuse, Alpine recommends searching /var/log/messages for Accepted password for on an account that has no password, then reviewing doas use and recently added accounts, files and authorised keys. No matching line cannot always exclude intrusion if logs are incomplete or rotated.

The defect is one comparison, but analysis crosses four contracts: /etc/shadow format, musl behaviour, OpenSSH anti-enumeration logic and authentication policy. The discovery team says it compared about 17,600 unusual attempts across combinations of libc and PAM before isolating the divergence. A sentinel value must never become positive proof of identity.

Primary sources: OpenSSH 10.6p2 release notes, upstream fix, Alpine Linux exposure matrix and advisory, Wakefield report, CVE-2026-123158 record.

Follow future rootzero publications

#rootzero

A question about your exposure?

Write to us. Someone from the technical team will answer, with sources.