Dev News Daily ENDE

Alpine Linux sshd bypass needs only a long password and an account without one

Alpine Linux has published a security advisory dated 5 November for its openssh-server package. An attacker who can reach the SSH port can log in without a password, in a single connection, if three conditions hold: password authentication is on, which is the OpenSSH default; the machine has an account whose password field is an asterisk, which is how key-only accounts are stored; and at least one other local account has a $5$ or $6$ password hash. No CVE identifier had been assigned when the advisory was written.

The cause sits between sshd and the C library. Alpine builds openssh-server without PAM, so sshd checks a password by running crypt() on the attempt and comparing the result with the stored field, borrowing the salt of another account when the stored field is too short to have one. musl's crypt() returns an asterisk as its error value when the key is longer than 256 bytes. That is exactly the content of a passwordless account's field, so a password of 257 to 1,024 bytes matches.

The exposure is broad. root ships as root:* since about Alpine 3.16, although the default PermitRootLogin setting blocks password logins for root. The official tiny-cloud images from 3.18.11 to 3.24.3 contain an alpine user with an asterisk and passwordless doas: safe on first boot, exploitable as soon as any password hash appears. Containers that do not run sshd, systems with PasswordAuthentication set to no and openssh-server-pam with UsePAM yes are not affected.

Fixed packages exist for every branch from 3.16 to edge; Alpine 3.21.10, 3.22.8, 3.23.8 and 3.24.4 include them, and OpenSSH 10.6p2 fixes the problem upstream. A running sshd must be restarted after the upgrade. Administrators who cannot update should disable password logins, and can check /var/log/messages for accepted passwords on accounts that have none.

Alpine Linux sshd bypass needs only a long password and an account without one
Alpine Linux sshd bypass needs only a long password and an account without one — Dev News Daily

What it means

Two components that each behave as documented produced a hole together. Turning off password authentication on servers that only use keys removes this whole class of problem.

Written by Victoria Shinder.