← Thu, Nov 5 digest

sshole

read article ↗ hn thread ↗

A subtle vulnerability in musl libc and OpenSSH allows authentication bypass when using long passwords on accounts with an asterisk hash.

read it A brilliantly structured deep dive into a subtle authentication bypass vulnerability caused by interactions between musl libc and OpenSSH.

summary

A security researcher uncovered a critical vulnerability stemming from the intersection of musl libc's error-handling in crypt() and OpenSSH's salt-handling behavior. When an account uses a '*' hash and receives a password longer than 256 bytes, musl returns '*' on failure, which OpenSSH mistakenly evaluates as a successful match. This allows authentication bypass on specific configurations like Alpine Linux running OpenSSH without PAM.

key points

  1. Musl libc caps SHA-512 passwords at 256 bytes, causing crypt() to fail and return an asterisk instead of NULL.
  2. OpenSSH borrows salts for non-existent or locked accounts to prevent timing attacks, inadvertently bridging the logic flaw.
  3. The bug primarily affects specific setups like Alpine Linux containers running OpenSSH without PAM where a user account has an asterisk hash.

who should read it

Systems engineers, security researchers, and Linux administrators.

discussion positive

consensus

Commenters marvel at the terrifying cascade of legacy design choices, in-band signaling, and subtle API divergences between musl and glibc that enabled a multi-decade bug chain.

pushback

Some argue over whether musl is more at fault for returning a magic string on error or OpenSSH for messy control flow.

best comment by mpyne ↗

OK, I think I see what’s going on with this, in this configuration.

The goal from an attacker’s perspective is to get this to be true: `$ret = crypt($pw, $hash); $ret == $hash` when called by OpenSSH’s sshd. This is how sshd validates that the user logging in knew the account password.

The `$hash` is the “settings” to the crypt call and will normally look like “$6$--gibberish” for users with passwords set, but could look like “*” or “!” for users not intended to be able to login.

The bug is from the intersection of all of these things:

1. musl can return “*” for errors, rather than leave …

It breaks down the complex interplay between the crypt return values and OpenSSH verification logic much more clearly than the original post.

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