← Thu, Nov 5 digest

Alpine Linux Security Advisory: OpenSSH-server password authentication bypass

read article ↗ hn thread ↗

Alpine Linux issued a security advisory for an OpenSSH-server password authentication bypass affecting systems built without PAM.

read it Critical security vulnerability with a specific technical root cause involving musl libc and OpenSSH, requiring immediate action for affected users.

summary

A vulnerability in Alpine Linux's OpenSSH server allows attackers to log in without a password if the system is built without PAM and contains at least one account with a SHA-256 or SHA-512 hash. The flaw stems from musl libc's crypt() function returning '*' as an error indicator for passwords over 256 bytes, which matches the '*' sentinel used for accounts with no password. This allows an attacker to bypass authentication by sending a very long password. Affected systems should update OpenSSH and restart the daemon or disable password authentication.

key points

  1. The bypass occurs when musl's crypt() returns '*' for passwords > 256 bytes, matching the password field of key-only accounts.
  2. Affected systems must be built without PAM (or UsePAM no) and have PasswordAuthentication enabled.
  3. The vulnerability affects all Alpine releases from 3.16 through 3.24 and edge.
  4. Updating the package is insufficient; the sshd daemon must be manually restarted to apply the fix.

who should read it

System administrators and developers using Alpine Linux as a host or in containers with sshd enabled.

discussion mixed

consensus

Commenters generally agree that the vulnerability is a dangerous deviation from the POSIX spec by musl libc. There is a broad consensus that disabling password authentication in favor of keys is the best practice.

pushback

A significant debate emerged regarding whether memory-safe languages like Rust would have prevented this logic bug, with some arguing Result types force error handling and others arguing it is a pure logic error.

best comment by NewJazz ↗

musl’s crypt() returns the string * as an error indicator when the key is over 256 bytes long. * is also exactly what the stored field contains for every account with no password, so the “hash” matches and the login succeeds.

Does anyone know why musl does this? Are they the only C library that behaves this way?

For a C library that famously tries to adhere to POSIX as much as possible, this seems like a crazy choice. From POSIX standard:

Upon successful completion, crypt() shall return a pointer to the encoded string. The first two bytes of the returned value shall be those of the salt …

It clearly explains the technical root cause and highlights the deviation from the POSIX standard regarding crypt() return values.

Generated by an LLM from the article and thread. Check the sources before relying on it.