Alpine Linux Security advisory: OpenSSH-server password authentication bypass al...

@best

Alpine Linux Security advisory: OpenSSH-server password authentication bypass alpinelinux.org · 181 points · 7 comments · HN thread

TL;DR Alpine Linux published a security advisory for an authentication bypass in openssh-server on Alpine systems built without PAM (or with openssh-server-pam and UsePAM no). An attacker who can reach the SSH port can log in as any account whose password field is '*' by sending a 257 to 1024 byte password, provided another account has a $5$ or $6$ hash. Fixed packages are available for edge and 3.16 to 3.24, and the advisory gives PasswordAuthentication no as a workaround; restarting sshd after upgrading is required.

  • The bug works in one connection: accounts with '*' password fields (key-only users, root in base images since about 3.16, and directory-service users) can be logged into with any password once the machine has at least one $5$ or $6$ hash.
  • Root cannot be reached by default because PermitRootLogin prohibit-password is the default, but a non-root account that can doas to root bypasses that protection.
  • Cause: musl's crypt() returns '' as an error value for keys over 256 bytes, which matches the '' stored for passwordless accounts; sshd borrows another account's salt for short fields.
  • Fixed openssh versions are listed per branch, for example 10.6_p2-r0 on edge and 10.3_p1-r2 on 3.24; upgrading the package alone does not replace the running daemon.
  • Tiny-cloud images from 3.18.11 to 3.24.3 ship an 'alpine' user with '*' and passwordless doas, and become exploitable once any $6$ hash is added.
  • No CVE had been assigned at the time of writing; the advisory suggests checking /var/log/messages for 'Accepted password' lines for passwordless accounts.

Discussion The thread is small and technical. Most of the discussion centers on the crypt() behavior that caused the bug, with commenters questioning why musl returns '*' instead of the POSIX-specified null pointer and error. The tone is curious and critical of the design choice, with some sympathy for the reasoning about timing side channels. One commenter points to a detailed external write-up and a larger earlier discussion on Hacker News.

  • musl's '*' return on long keys is a dangerous spec deviation (many): Commenters argue that returning a sentinel string instead of NULL and errno violates POSIX and creates an exploitable collision with '*' locked-password entries. They see it as a plain bug rather than a design choice.
  • Sentinel return was a defensible hack against crashes and timing leaks (some): One commenter notes that developers who forget to check for NULL would crash, and that a fake hash result helps prevent timing side channels that reveal whether a user exists. They still consider the crypt(3) API itself outdated.
  • The crypt(3) API is outdated and should not be used (some): Commenters point out that libc crypt(3) defaults to the broken DES algorithm and call for modern hashing libraries instead. They see the root problem as the API design rather than only musl.
  • Constant-time comparison would not have prevented this (a few): A commenter questions whether even constant-time string comparison would have avoided leaking whether accounts are disabled, since the compared strings differ in length. This is a side discussion about timing attacks.

Links from the comments

#security #openssh #alpineLinux #musl #authBypass #crypt