blog.rust.gay

musl's failure token made locked accounts log in

OpenSSH 10.6p2, released on November 5, adds a workaround for CVE-2026-123158. The bug is a password-authentication bypass on Linux systems that use musl libc, build sshd without PAM, and leave password authentication enabled. Alpine is the obvious example, but Buildroot, Yocto and OpenWrt images can have the same combination.

The mechanism is a fail-open, not a crash. musl's crypt() returns the literal string * when the supplied password is longer than 256 bytes. sshd compares that return value to the stored password field. Accounts with no password store * in that field. The two strings match, and the login succeeds.

Three reasonable decisions, one bad match

Each part of the chain is defensible on its own.

musl uses an in-band error token. When crypt() cannot process a password, it returns * rather than a null pointer. That is a choice about API shape: the caller gets a string it can compare, and the failure is visible without a separate error channel.

sshd trusts the library's return value. It hashes the attempt, compares the result to the stored field, and accepts a match. That is what a password check is supposed to do. The daemon does not know that * is also a sentinel.

The image author uses * to lock an account. That is a decades-old convention in /etc/shadow: * means the account has no usable password. It is the standard way to say "this account exists but cannot log in with a password."

Put the three together and the failure mode is exact. The library says "failure" with the same string the image uses for "locked." The daemon sees a match. The account opens.

There is one more condition. sshd needs a salt to hash the attempt, and it borrows the salt from another account's $5$ or $6$ hash. A machine with at least one such account makes every passwordless account reachable. A machine with no salted hashes at all does not expose the path in the same way. That is why the bug is conditional rather than universal.

Who is actually exposed

The affected configuration is specific: musl libc, no PAM, password authentication on, and at least one account with a $5$ or $6$ hash. glibc systems are not affected because their crypt() does not return * for this input. Alpine's openssh-server-pam package with UsePAM yes takes a different authentication path and is not affected. Accounts locked with ! are not affected either.

Alpine's official tiny-cloud images from 3.18.11 through 3.24.3 are the sharpest example. They ship an alpine user with no password and passwordless doas. On first boot they are safe, because there is no salted hash to borrow. Once an administrator sets a console password, a $6$ hash exists, and the alpine account becomes reachable. An attacker can log in as alpine and use doas to become root. Root itself is only reachable directly if PermitRootLogin yes is set.

Alpine says cloud images configured through cloud-init are not affected, because cloud-init writes PasswordAuthentication no unless user-data explicitly sets ssh_pwauth: true. That is a good default, and it is also a reminder that the exposure depends on configuration, not on the distribution's reputation.

The flaw dates to 2016 and was reported by Özgün Kültekin of Wakefield. OpenSSH considers the root cause to be outside sshd; the 10.6p2 workaround adds a minimum-length check on the stored hash in the daemon. That is a reasonable place to put the guard, because the daemon cannot assume every libc will use a distinguishable failure token.

Version numbers are not patch status

Alpine backported the fix to every branch from 3.16. That is the right thing to do, and it breaks the usual way people reason about versions. A host running an older OpenSSH version number may already have the fix. A host running a newer number may not, if the package was built before the backport.

sshd -V is therefore not proof of anything. The package release is the thing to compare with the advisory. On Alpine, apk list -I 'openssh*' shows the installed package and its release. The fixed package keeps the older upstream version in its name, so the release suffix is what changed.

There is a second version trap: upgrading the package does not replace the running daemon. sshd keeps the old binary in memory until it is restarted. A host can have the fixed package installed and still be running the vulnerable code. Restart sshd after the upgrade, then confirm that the service came back.

The researcher's public check script compares version numbers, so it can report a backported fixed package as exposed. That is not a reason to ignore the script; it is a reason to read its output carefully. The package release and the running process are the authoritative signals.

What to check and what to do

The exposure check has three parts: the C library, the PAM configuration, and the password field. On a host you can inspect, the commands are straightforward:

ldd "$(command -v sshd)" | grep musl
sudo sshd -T | grep -i passwordauthentication
sudo awk -F: '$2 == "*" {print $1}' /etc/shadow

If the first command shows musl, the second shows passwordauthentication yes, and the third lists accounts, the host matches the vulnerable configuration. The third command prints account names, not hashes; do not copy the hashes into a ticket.

sshd -T without -C ignores Match blocks, so a Match block that enables password authentication can hide from the simple check. Inspect sshd_config and its drop-in files, or test the relevant Match conditions with sshd -T -C user=.... This is the kind of detail that decides whether a fleet scan is meaningful.

The fix is to update OpenSSH to 10.6p2 or the distribution's fixed package, then restart sshd. If an update is not possible yet, set PasswordAuthentication no, including inside Match blocks, and restart. Key-based authentication is the better end state anyway, but a rushed configuration change can lock out the people who need access, so keep an existing session open while testing.

After patching, check the logs for Accepted password for entries on accounts that should not have passwords. If such an entry exists, or if the logs do not go back far enough to rule it out, treat the host as compromised. The bug is a login bypass, so the relevant evidence is a successful login, not a crash.

The logging gap is part of the problem. A minimal image may not keep auth logs for long, and an appliance may not expose them at all. If the retention window is shorter than the time the device has been exposed, the absence of a log entry is not evidence of safety. That is another reason to patch first and investigate second, rather than waiting for a clean log review.

The bigger lesson

Fail-open bugs deserve a different review standard than crashes. A crash is loud. A fail-open is quiet: the system reports success, the logs show a normal login, and nothing looks wrong until someone asks why a locked account has a session.

The specific design problem is the collision between an error token and a data sentinel. A library that returns * on failure is not wrong in isolation, but it is dangerous when a caller compares the result to a stored field that uses * for a different meaning. The same pattern can appear in other login paths that call crypt() and compare the result to /etc/shadow: console logins, web-admin password checks, custom PAM-less daemons. The OpenSSH workaround fixes sshd. It does not audit those callers.

That is the useful takeaway for anyone shipping an appliance or a minimal image. Do not assume that a failed crypt() returns something that cannot match a stored value. Check the contract of the libc you ship, and test with an oversized password. A one-line test would have found this in 2016.

The appliance problem

The systems most likely to be affected are also the ones least likely to be patched quickly. Alpine, Buildroot, Yocto and OpenWrt are common in routers, cameras, industrial gateways, medical devices and other appliances that ship with a long support tail. The image is often built once, signed, and deployed for years. The package manager may not be present at all.

That changes the remediation calculus. A server can run apk upgrade and restart sshd. An appliance may need a firmware update, a signed image, and a maintenance window. If the vendor has not shipped a fixed build, the operator's only option is to disable password authentication, which may break the management interface the appliance was sold with.

The version-number trap makes this worse. A vendor may backport the fix without changing the upstream version string, or may ship a new version number with an old package release. The only reliable check is the package release and the running daemon, and on an appliance the operator may not have shell access to either.

The practical move is to treat sshd on musl as part of the attack surface during procurement. Ask the vendor which libc the image uses, whether sshd is built with PAM, whether password authentication is on by default, and how security fixes are delivered. Those questions are cheaper before the device is in the field than after.

Conclusion

CVE-2026-123158 is narrow: musl, no PAM, password authentication, and a salted account to borrow a salt from. It is also a clean example of how three locally reasonable decisions produce a remote login bypass. The fix is available, the backports are real, and the important operational step is to check the running daemon rather than the version string. If you run Alpine, Buildroot, Yocto or OpenWrt with sshd, check the three conditions this week. If you cannot patch, turn password authentication off and keep it off.

Sources


← back to posts