Skip to content
Access control Write-up Advanced

How Long Passwords Can Bypass SSH Authentication on Alpine Linux

On Alpine Linux with musl libc and OpenSSH built without PAM, an attacker who knows the name of a passwordless account could authenticate by submitting a password between 257 and 1,024 bytes long. The error value returned by musl's crypt() for an overlong password matched the '*' marker stored for passwordless accounts, so the password check succeeded without the correct password.

Ismail Tasdelen Follow

Published on ismailtasdelen.medium.com

A password is supposed to be the simplest part of an SSH login: the server hashes what you type, compares it with the account’s stored password hash, and accepts or rejects the result.

Ismail Tasdelen, on ismailtasdelen.medium.com

The full write-up lives on its author's site

It belongs to its author, so we link to it rather than copy it. The other two tabs are our own rewrites, checked against it.

Not written yet. The AI write-up for this write-up has not been written yet. The Original tab links to the source.

How it worked

Root cause

Likely a sentinel collision: musl's crypt() returns '*' on failure for overlong passwords, and OpenSSH compared that error result against the '*' stored in the shadow field of passwordless accounts, treating the two as equal.

Impact

An attacker who could reach SSH and knew a passwordless account name could log in as that account without a valid password; the issue only affects hosts meeting all the listed conditions, such as Alpine's non-PAM OpenSSH with password authentication enabled and a suitable salt-bearing account present.

What the attacker needed

Alpine openssh-server without PAM, or UsePAM no; PasswordAuthentication enabled; A passwordless account with * in shadow; Another account with a $5$ or $6$ hash

The fix

Alpine fixed the issue in updated OpenSSH packages, and operators should upgrade and restart sshd; OpenSSH 10.6p2 also works around it by rejecting matches where the stored password field is implausibly short for a real hash.

How it was found

  1. Reach the SSH service on an affected Alpine host.
  2. Know the name of an account whose password field is '*'.
  3. Submit a password between 257 and 1,024 bytes long.
  4. Be authenticated as that passwordless account without the correct password.

Explained by bugbounty.wiki with AI from the original and checked against quotes from it; it can still be wrong. Read the original before relying on a detail.

Not written yet. The AI write-up for this write-up has not been written yet. The Original tab links to the source.

SSH normally checks your password by hashing it and comparing the result with a stored hash. On some Alpine Linux systems, a very long password made the hashing function fail and return a special error marker, which happened to equal the marker used for accounts that have no password at all. The server then treated the failed hash as a match, letting someone log in as that passwordless account without knowing any real password.

What is Access control?

A user can do something their role should not allow: reach an admin function, act on a feature they have not paid for, or skip a permission check. IDOR is the special case where the object belongs to someone else.

More by Ismail Tasdelen

View all

7 more disclosed reports, best first.

Similar reports

View all

Same bug class and techniques, clearest first.

Broken access control

The lesson behind this report.

A user can do something their role should not allow: reach an admin function, act on a feature they have not paid for, or skip a permission check. IDOR is the special case where the object belongs to someone else.