Alpine Linux Security Advisory: OpenSSH-server password authentication bypass al...
HN Best 30 @best30
Alpine Linux Security Advisory: OpenSSH-server password authentication bypass alpinelinux.org · 263 points · 21 comments · HN thread
TL;DR Alpine Linux published a security advisory for an authentication bypass in openssh-server: on affected systems an attacker can log in over SSH as any account whose password field is '*' (no password, key-only accounts, root) by sending a 257 to 1024 byte password, provided at least one other account has a $5$ or $6$ hash. The fix is OpenSSH 10.6p2 and updated Alpine packages, which must be followed by an sshd restart; disabling PasswordAuthentication is the stopgap.
- Affected: Alpine openssh-server builds without PAM (or openssh-server-pam with UsePAM no) with PasswordAuthentication yes, on releases 3.16 through 3.24 and edge.
- Root is only reachable if PermitRootLogin yes is set, but any login-capable account that can use doas to become root also exposes it.
- Root cause: musl's crypt() returns '' as an error indicator for keys over 256 bytes, which matches the '' stored for passwordless accounts, so sshd accepts the login.
- Fixed packages: edge 10.6_p2-r0, 3.24 10.3_p1-r2, 3.23 10.2_p1-r1, 3.22 10.0_p1-r11, 3.21 9.9_p2-r1, with older branches also patched. Upgrading does not restart a running sshd.
- Official tiny-cloud images from 3.18.11 to 3.24.3 ship an 'alpine' user with a '*' password and passwordless doas, becoming exploitable once any $6$ hash exists on the machine.
- No CVE had been assigned at the time of writing; the reporter is credited as Özgün Kültekin.
Discussion The thread centers on the musl crypt() behavior that caused the bug and whether it was a sound design choice. Commenters trace the history (a detailed write-up at sshhole.com and an earlier HN discussion are linked), debate whether returning the '*' sentinel violates POSIX, and note that the sentinel was partly chosen to avoid NULL returns that crashed careless callers and to hide account existence through timing. The mood is critical and technical, with one long sub-thread drifting into a broader argument about C versus memory-safe languages that other commenters push back on as beside the point, since this is a logic bug.
- musl's crypt() returning '*' is a real bug (many): Several commenters say deviating from POSIX, which requires a null pointer and errno on failure, is dangerous. One notes musl is usually strict about spec compliance, which makes this stand out.
- Sentinel was a defensible trade-off (some): Some point out that returning a non-NULL value avoids crashes in programs that skip NULL checks, and that a fake hash check helps prevent timing leaks about which accounts exist.
- The bug is logic, not a language problem (many): Commenters argue the flaw would be possible in Rust, Go or Python, since returning a sentinel string that collides with a stored value is a logic error rather than memory safety.
- C is the root cause and should be replaced (some): A minority argues that C's weak type system and error handling make such mistakes likely and that the industry should move to safer languages faster.
- Crypt API itself is outdated (a few): One commenter notes the crypt(3) interface defaults to a broken DES algorithm in its man page and questions why anyone still uses it.
Links from the comments
- Earlier HN discussion of the sshhole write-up.
- Earlier HN discussion of the same issue from a few hours before this thread.
- POSIX specification for crypt(), quoted for the return-value requirements.
#security #openssh #musl #alpineLinux #cryptography #csecurity