Go straight to an AI summary of this blog post instead

  • Summarize this post with Perplexity
  • Summarize this post with Gemini

Key Takeaways

  • A password of 257 to 1024 bytes logs in to any key-only account on Linux systems that run sshd on musl libc without PAM, Alpine Linux above all. OpenSSH 10.6p2 ships the workaround, and the bug is tracked as CVE-2026-123158.
  • The bug lives between two projects. Since 2016 sshd has borrowed another account's salt for a * account, and musl's crypt() answers an over-long password with the string “*”, which matches the stored *. OpenSSH says the root cause is outside sshd; the musl maintainer calls it an erroneous use by the caller.
  • We reproduced it on Alpine Linux 3.18: the second try in one connection logs in, a bcrypt hash removes the length limit, and the fixed package denies every attempt. Update and restart sshd, or turn off password login; on Alpine 3.18 and older the sshd_config.d drop-in alone does nothing.
  • Alpine Linux 3.18 reached end of life in May 2025 and got a fix this time as an exception. TuxCare Endless Lifecycle Support (ELS) turns that into a promise: Alpine 3.18 ELS gets the same upstream commit as openssh 9.3_p2.tuxcare.els7.

On November 5, 2026, the OpenSSH team released version 10.6p2 with a critical security workaround. On some Linux systems an attacker can log in over SSH to an account that should never accept any password. There is no password to guess. The attacker only needs the name of such an account. In the most common setup the attacker sends one wrong password and then a password between 257 and 1024 bytes long, in the same connection. In some setups, even a short password works, as we show below.

The bug is tracked as CVE-2026-123158 (CVSS 3.1 score 8.1). It was found by Özgün Kültekin of Wakefield (wakefield.co). The code path behind it has been in portable OpenSSH since 2016, from version 7.3 up to 10.6p1.

This bug is unusual because it lives between two projects. The attack does not need a buffer overflow, a crash or memory corruption. It is a logic bug that shows up only when OpenSSH and the musl C library run together on the same system, and the two projects do not agree on whose bug it is. The OpenSSH release notes put it this way.

“We consider the root cause of this bug to be outside sshd, but it is exploitable via sshd and can be avoided there.”

The musl maintainer, Rich Felker, sees it the other way.

“It is my position that this is not a bug in musl just an erroneous use by the caller.”

In this post, we read the code of both projects, show step by step how the login happens, and reproduce the attack on Alpine Linux in our lab.

Who is affected

The attack works only when all of these things are true on the same server.

  • sshd is linked with musl libc. Alpine Linux is the best known case, and it is also the base of many Docker images, but only images that run sshd are exposed. The bug is not tied to Alpine. Any Linux system or device that runs an sshd built with musl and without PAM can be hit, including custom firmware and self-built sshd binaries.
  • sshd does not use PAM (the authentication framework most Linux distributions use for logins) to check passwords. On Alpine the default openssh-server package is built without PAM. The openssh-server-pam package running with UsePAM no is affected too.
  • Password login is enabled with PasswordAuthentication yes, which is the default.
  • The target account has a single * as its password. The typical case is a key-only user with * in /etc/shadow. On Alpine without PAM, an account with ! cannot log in even with an SSH key, so admins change ! to * to make key login work. Root in the Alpine base image has * too, since about Alpine 3.16, but sshd blocks password login for root unless PermitRootLogin yes is set. Users that come from a directory service through musl-nscd have no shadow entry and can also end up with *.
  • The first account in /etc/passwd order whose hash starts with $ must use a hash type that musl can fail on. With a normal $5$ or $6$ hash (SHA-256 or SHA-512 crypt) the attacker needs 257 to 1024 bytes, and Alpine's passwd writes $6$ by default. With a bcrypt hash ($2a$, $2b$ or $2y$) any non-empty password up to 1024 bytes works. With an old $1$ (MD5) hash, a yescrypt $y$ hash, or no $ hash at all, the attack does not work.

The vulnerability does not exist on these systems.

  • Non-Linux systems.
  • Linux systems with glibc, like RHEL, AlmaLinux, CloudLinux, Debian or Ubuntu.
  • Linux systems where sshd checks passwords through PAM.

Accounts locked with ! instead of * are also safe, and so are servers with PasswordAuthentication no. If you only need the steps, jump to “What to do now” near the end.

What a single star in /etc/shadow means

On Linux, password hashes live in /etc/shadow. A hash is a one-way scrambled form of the password. When you log in, the system hashes what you typed in the same way and compares the two results. If they are equal, you are in.

A normal entry looks like this:

alice:$6$Qx7Lm2Pa$k3J9...long hash...:20000:0:99999:7:::

The $6$ at the start indicates SHA-512 crypt, a password-hashing method based on SHA-512. The part after it, Qx7Lm2Pa, is the salt. A salt is a small, random string mixed into the password, so two users with the same password still get different hashes.

Since around 1980, when the hashes still lived in /etc/passwd, Unix admins put a single * in this field when an account must never log in with a password. The logic is simple. No password in the world hashes to just *, because a real hash is always much longer. So the account can still log in with an SSH key, but never with a password. The whole bug is about breaking this idea.

How sshd checks a password without PAM

When PAM is off, sshd checks the password by itself in sys_auth_passwd() in auth-passwd.c. This is the code from OpenSSH 9.3p2, the version shipped with Alpine Linux 3.18, before the fix.

/* Just use the supplied fake password if authctxt is invalid */
char *pw_password = authctxt->valid ? shadow_pw(pw) : pw->pw_passwd;
...
/*
 * Encrypt the candidate password using the proper salt, or pass a
 * NULL and let xcrypt pick one.
 */
if (authctxt->valid && pw_password[0] && pw_password[1])
    salt = pw_password;
encrypted_password = xcrypt(password, salt);

/*
 * Authentication is accepted if the encrypted passwords
 * are identical.
 */
return encrypted_password != NULL &&
    strcmp(encrypted_password, pw_password) == 0;

This is the classic way. Read the stored hash, hash the typed password with the stored hash as the salt, and compare the two strings.

Now look at the salt line. sshd uses the stored value as the salt only when it has at least two characters. A * has only one. So for a * account the salt stays NULL, and xcrypt() has to pick a salt by itself.

The 2016 change

Why does xcrypt() pick a salt? The answer is CVE-2016-6210. In 2016 a researcher showed that sshd answered at a different speed for users that do not exist. By sending long passwords and measuring the time, an attacker could build a list of real user names.

To close that gap, Darren Tucker modified sshd so that when it has no usable salt, it borrows the hash type and salt from a real account on the system. The first commit, 9286875a “Determine appropriate salt for invalid users”, borrowed the salt of root. Six days later, dbf788b4 “Search users for one with a valid salt” made it search all accounts. Both shipped in OpenSSH 7.3 in August 2016. The change was meant for users that do not exist. But the two character check above sends a valid account with * down the same path, so it gets the borrowed salt too.

This is pick_salt() in openbsd-compat/xcrypt.c, as it looks in 9.3p2.

if (salt[0] != '\0')
    return salt;
strlcpy(salt, "xx", sizeof(salt));
setpwent();
while ((pw = getpwent()) != NULL) {
    if ((passwd = shadow_pw(pw)) == NULL)
        continue;
    if (passwd[0] == '$' && (p = strrchr(passwd+1, '$')) != NULL) {
        typelen = p - passwd + 1;
        strlcpy(salt, passwd, MINIMUM(typelen, sizeof(salt)));
        explicit_bzero(passwd, strlen(passwd));
        goto out;
    }
}
out:
endpwent();
return salt;

It walks over the accounts in /etc/passwd order and takes the first $…$ salt it finds, for example $6$Qx7Lm2Pa from alice. It keeps the result, so later tries in the same connection get the cached salt. If no account has a $ hash, it falls back to xx, the old DES type.

Before this change, sshd used “xx” for short entries like *. Old DES does not fail on long passwords, it simply uses the first 8 characters, so it could never return *. After the change, a * account gets the salt of another user. This is how the problem started in 2016. The change was a good fix for a real timing problem, and as far as anyone knows, nobody noticed the side effect.

What musl's crypt() returns on error

musl is a small C library used by Alpine and by many embedded systems. Its SHA-512 crypt code is in src/crypt/crypt_sha512.c. It limits the password length, to protect the system from slow, CPU-heavy requests.

/* key limit is not part of the original design, added for DoS protection.
 * rounds limit has been lowered (versus the reference/spec), also for DoS
 * protection. runtime is O(klen^2 + klen*rounds) */
#define KEY_MAX 256
...
    /* reject large keys */
    for (i = 0; i <= KEY_MAX && key[i]; i++);
    if (i > KEY_MAX)
        return 0;

A password longer than 256 bytes is rejected. Now see what __crypt_sha512(), the internal function that crypt() calls, returns in that case.

p = sha512crypt(key, setting, output);
/* self test and stack cleanup */
q = sha512crypt(testkey, testsetting, testbuf);
if (!p || q != testbuf || memcmp(testbuf, testhash, sizeof testhash))
    return "*";
return p;

On error, musl's crypt() returns the string “*”. The SHA-256, MD5 and Blowfish code do the same, and only SHA-256 and SHA-512 have the 256 byte limit. musl has worked like this since 2012. POSIX says crypt() shall return a null pointer and set errno on error, but musl chose a string on purpose. Its commit b3c4cc12 explains that “a large portion of programs which call crypt are not prepared for its failure and do not check that the return value is non-null”, and it calls the result an “unmatchable hash”.

The problem is that * is also the value that means “no password login” in /etc/shadow.

musl did protect the classic pattern. Look at the last line of the DES code in crypt_des.c.

return (setting[0]=='*') ? "x" : "*";

If the salt itself starts with *, musl returns x instead. So crypt(password, “*”) never gives back “*”. This protects the classic check, where a program uses the stored value as the salt and then compares the result with that same stored value.

But sshd did not use the stored value as the salt. It used the salt of alice. musl saw $6$…, so this protection could not help.

A tiny test

We checked the C library part ourselves with a tiny test program. These are its two key lines, simplified. It hashes passwords made only of the letter A with a borrowed $6$ salt, and compares the result with *.

r = crypt(long_password, "$6$abcdefgh");  /* salt borrowed from another account */
ok = (r != NULL && strcmp(r, "*") == 0);  /* compare with the "*" in /etc/shadow */

We ran it on Alpine Linux 3.18 (musl) and on Debian 12. On Debian, like on most modern glibc systems, crypt() comes from a separate library called libxcrypt.

== musl (Alpine 3.18) ==
len=   8 crypt()=$6$abcdefgh$65STptHV...  match "*": no
len= 256 crypt()=$6$abcdefgh$9SA4XFln...  match "*": no
len= 257 crypt()=*  match "*": YES
len=1024 crypt()=*  match "*": YES
== libxcrypt (Debian 12) ==
len=   8 crypt()=$6$abcdefgh$65STptHV...  match "*": no
len= 256 crypt()=$6$abcdefgh$9SA4XFln...  match "*": no
len= 257 crypt()=$6$abcdefgh$D4Ayo9g5...  match "*": no
len=1024 crypt()=*0  match "*": no

On musl, every password from 257 bytes up matches the star. With libxcrypt, a 257 byte password is hashed normally. libxcrypt has its own limit of 511 bytes, but when it fails it returns *0, or *1 when the salt starts with *0. A two character error string can never be equal to a one character *, so the comparison fails, as it should.

The full chain from long password to login

Here is the full chain for an attacker who targets a key-only user on an Alpine server. That user has * in /etc/shadow, and the first $ hash on the system is the $6$ hash of another user.

  1. The attacker connects to SSH and asks for password login as the key-only user.
  2. The attacker sends a password of 300 bytes. sshd accepts passwords up to 1024 bytes (MAX_PASSWORD_LEN), so it continues.
  3. sshd reads * from /etc/shadow. It has only one character, so there is no salt.
  4. pick_salt() borrows the $6$ salt of the other user.
  5. musl's SHA-512 code sees more than 256 bytes and fails. crypt() returns “*”.
  6. On this first try sshd has already lost the stored *, for a side reason we explain below, so the comparison fails. The attacker simply tries again in the same connection.
  7. On the second try sshd compares “*” with the stored “*”. They are equal. Login accepted.

This is why the attack window is 257 to 1024 bytes when the borrowed salt is $5$ or $6$. Below 257, musl hashes the password normally. Above 1024, sshd rejects it before hashing. The CVE text says “between 256 and 1024 characters”, but the real window starts at 257 bytes.

With bcrypt, the length does not matter

There is one more path, and it is not in the Alpine advisory or the CVE. We found it while checking the code. pick_salt() cuts the hash at its last $. A bcrypt hash looks like $2b$10$ followed by 53 characters, with no $ between the salt and the hash. So sshd keeps only $2b$10 and loses the salt itself. musl rejects that setting, and on error it returns “*” again. This time the password length does not matter.

Upstream fixed this salt bug on October 30, 2026, in commit 84f8f466 “fix fake password salt generation for bcrypt hashes”.

+            /*
+             * bcrypt ($2*$NN$) has no '$' between its 22 character
+             * salt and the hash, so keep the salt too or crypt(3)
+             * will reject the setting without doing any work.
+             */
+            if (passwd[1] == '2' && strlen(p + 1) >= 22)
+                    typelen += 1 + 22;

The commit message talks about a timing problem, but on musl the effect is much worse. This commit is on the master branch and is not part of 10.6p2. The 10.6p2 workaround still blocks this path, because a * is shorter than 4 characters.

We tested it on Alpine 3.18 with a bcrypt hash as the first $ hash on the system. On the old package, every non-empty password from 1 to 1024 bytes logged in to the * account, on the second try. The fixed package denied all of them. Alpine's passwd writes $6$ by default, so this path needs a bcrypt hash that an admin or a tool put there.

Alpine cloud images

Alpine's advisory names the alpine user in the official tiny-cloud images from 3.18.11 to 3.24.3. That user has *. A fresh image is not exposed, because no account has a real password hash yet. It becomes exposed as soon as some account gets a $6$ hash while password login is on. Images configured through cloud-init, which writes PasswordAuthentication no, are not affected. The researcher notes that on the official AWS and Azure images the alpine user can run doas (Alpine's equivalent of sudo) without a password, so a login as alpine there is the same as root.

We reproduced it on Alpine

The crypt() test shows the C library part. We also wanted to see a real sshd let us in, so we built a small lab.

We used two images:

  • Alpine Linux 3.18 with openssh-server 9.3_p2-r3, the last Alpine package before the fix.
  • Alpine Linux 3.18 with openssh-server 9.3_p2-r4, the fixed package.

In both we gave one account a real password with Alpine's own passwd tool. Then we added a key-only account with * and a locked account with !, and tried to log in with passwords of different sizes. “LOGGED IN” means that the second try in the same connection was accepted and sshd ran a command for us as that user.

                                   Alpine 3.18     Alpine 3.18
                                   9.3_p2-r3       9.3_p2-r4
                                   (before fix)    (fixed)
key-only (*), 8 bytes              denied          denied
key-only (*), 256 bytes            denied          denied
key-only (*), 257 bytes            LOGGED IN       denied
key-only (*), 1024 bytes           LOGGED IN       denied
key-only (*), 1025 bytes           denied          denied
locked (!), 300 bytes              denied          denied
root (*), default config           denied          denied
root (*), PermitRootLogin yes      LOGGED IN       denied
key-only (*), 1 byte, with bcrypt  LOGGED IN       denied
real password                      accepted        accepted

On the fixed package every attack failed, while the real password still worked as before. The normal ssh client sends at most 1023 bytes, so a longer typed password is simply cut into the attack window. For the 1024 and 1025 byte rows we used a small client that sends the exact length. At 1025 bytes sshd refused the password before hashing it. For the bcrypt row, the first $ hash on the system was a $2b$ hash instead of $6$.

Why every attack needed two tries

In every vulnerable run in the table, the first password try failed and the second try in the same connection worked. The first try can be any wrong password up to 1024 bytes. We confirmed the reason with a small probe that logs what sshd passes to strcmp(). On the first try sshd compared “*” with whatever was left at the address of the stored *, in our lab an empty string. On the second try it compared “*” with “*”.

The cause is a buffer problem in sshd. shadow_pw() returned a pointer into the buffer that musl's getspnam() reuses for every lookup. The first try runs pick_salt(), which looks up other accounts in that same buffer and then wipes the borrowed hash with explicit_bzero(). So the * that sshd was still pointing to is gone. From the second try on, the salt is cached, no other lookup happens, and * matches *. The 10.6p2 workaround fixes this too, as we show in the workaround section.

The second try is needed only when the * comes from /etc/shadow and sshd runs with default settings. In our lab, an account with * in /etc/passwd and no shadow entry was accepted on the very first try. With PermitEmptyPasswords yes, the sshd option that lets accounts with an empty password log in, even a * in /etc/shadow was accepted on the first password try.

Directory-service users likely behave like the /etc/passwd case, but we did not test that. This fits both public sources. Alpine's advisory says the attack takes one connection and needs no retries, and the researcher's page says that a * in shadow needs a wrong try first.

sshd allows 6 tries per connection by default (MaxAuthTries), so the extra try does not stop an attacker. In the /etc/shadow case it leaves a failed try and an accepted try from the same connection port.

Failed password for keyonly from 127.0.0.1 port 53734 ssh2
Accepted password for keyonly from 127.0.0.1 port 53734 ssh2

So, is it an OpenSSH bug or a musl bug?

The OpenSSH team says the root cause is outside sshd, and there is a good case for that. The classic check, used for decades, hashes the typed password with the stored value as the salt and compares the result with that same value. musl keeps that pattern safe, because its error string never equals the salt it was given. On glibc systems the very same sshd code is safe too.

There is also a case on the other side. Since 2016 sshd hashes a one character entry with the salt of another account and still compares the result with the stored value, and it kept a pointer into a C library buffer that changed under it. musl's guard could not help with that. Rich Felker sees it this way and calls it “an erroneous use by the caller”. He also wrote that the mechanism behind it “very likely will be changed in the upcoming release cycle” of musl.

So this bug needed three pieces, and each one looks fine alone:

  • The * that marks an account with no password login, a Unix custom from around 1980, when the hashes still lived in /etc/passwd.
  • The “*” error string and the 256 byte limit in musl, from 2012.
  • The borrowed salt in sshd, from 2016.

No single project owns the whole bug, and this helps explain why it stayed hidden for 10 years. You have to look at how the pieces behave together, and you only see it on a musl system without PAM. The researcher found it by building sshd with different C libraries and PAM settings and testing thousands of unusual logins.

The fix in OpenSSH

Damien Miller wrote the workaround. On the V_10_6 branch it is commit 90f9c2f7 “avoid password authn bypass”, and on master the same change is commit 4353fdc4. The main part is very small.

+#define MIN_PASSWORD_HASH_LEN    4
 #define MAX_PASSWORD_LEN 1024
...
-    return encrypted_password != NULL &&
+    ret = encrypted_password != NULL &&
+        strlen(pw_password) >= MIN_PASSWORD_HASH_LEN &&
         strcmp(encrypted_password, pw_password) == 0;
+    freezero(pw_password, strlen(pw_password));
+    return ret;

A real password hash is never shorter than 4 characters. Now, if the stored value is *, !, x or anything else that short, the hash comparison always fails, no matter what crypt() returns. This blocks every path in this post, including the bcrypt one. The separate empty password case, controlled by PermitEmptyPasswords, is not changed.

The patch also changes shadow_pw() so it returns a copy of the shadow entry, made with xstrdup(), and wipes that copy after use. This removes the buffer problem behind the two tries.

On the openssh-unix-dev list, Damien Miller explained the choice. He wrote that “we're in a good position to deliver a mitigation quickly”. At the time of writing, musl still returns “*” on error, but its maintainer expects to change that mechanism in the next release cycle.

What to do now

Update and restart sshd

On Alpine, update and restart like this. This is the command from the Alpine advisory. The -a flag also lets apk replace or downgrade packages to match the repositories, so review what it changes.

apk upgrade -U -a
rc-service sshd restart

OpenSSH 9.3p2 starts a fresh copy of /usr/sbin/sshd for every new connection, so in our lab new logins used the fixed code as soon as the package was installed. Restart sshd anyway, so the listening process runs the new binary too. In a container, rebuild the image from a fixed base and restart the container. TuxCare ELS customers on Alpine Linux 3.18 get the fix from the ELS repository.
Explore ELS →

If you cannot update today, turn off password login

This turns off password login for every user, not only for the accounts at risk. Make sure everyone who needs access has a working SSH key, and keep your current session open. Be careful with the drop-in folder /etc/ssh/sshd_config.d. Alpine's default config reads it only from 3.19 on, so on 3.18 and older a drop-in file alone does nothing. These commands from the Alpine advisory write the drop-in and also change /etc/ssh/sshd_config itself, with a backup in /etc/ssh/sshd_config.bak.

mkdir -p /etc/ssh/sshd_config.d
echo 'PasswordAuthentication no' > /etc/ssh/sshd_config.d/00-no-passwords.conf
sed -i.bak -e '1i PasswordAuthentication no' \
  -e 's/^\(\s*PasswordAuthentication[^y#]*\)yes/\1no/i' \
  /etc/ssh/sshd_config
sshd -t && rc-service sshd restart
sshd -T | grep -i passwordauthentication

The last command should print passwordauthentication no. If it does not, password login is still on.

Look for logins that should not happen

Look for Accepted password for lines in /var/log/messages, the default syslog file on Alpine, for accounts that have *. In the /etc/shadow case our lab always showed a Failed password line just before it, from the same connection port. Do not rely on that pair alone. In other setups the first try can already succeed, a real user who mistypes leaves the same pair, many containers run no syslog daemon and log nothing, and an attacker with root can clean the logs. Also check for new users, new keys in authorized_keys and doas usage. If you cannot rule out a login, treat the machine as compromised.

Check older and hidden systems

Old Docker images and embedded devices sometimes run OpenSSH on musl, and nobody updates them. Check them too.

Why TuxCare matters here

The upstream workaround landed in OpenSSH 10.6p2. Many production systems do not run the newest OpenSSH. They run the version that came with their distribution years ago. Alpine Linux 3.18 ships OpenSSH 9.3p2 and reached its end of life in May 2025.

Alpine handled this one very well. On the day of the disclosure they published fixed packages for every branch back to 3.16, also for branches past their end of life. For Alpine 3.18 that is 9.3_p2-r4, the fixed package in our lab. But Alpine does not promise fixes for end-of-life branches. This time they made one, and for the next bug nobody can say.

TuxCare Endless Lifecycle Support (ELS) turns that into a promise. For Alpine Linux 3.18 ELS, our team backported the same upstream commit to OpenSSH 9.3p2 and merged it on the same day the upstream release came out. It applies on top of all 22 patches of our ELS package, and it is the same code as Alpine's own pw.patch. The fixed package will be openssh 9.3_p2.tuxcare.els7, for x86_64 and aarch64.
Explore ELS →

This bug also shows why watching one project's advisories is not enough. The bug needs code from both musl and OpenSSH, the workaround sits in OpenSSH, and the affected systems are musl-based servers, containers and embedded devices. Somebody has to follow all of them and ship a tested patch for the versions customers still run. That is the work our security team does.

Join 4,500+ Linux & Open Source Professionals!

2x a month. No spam.

Table of Contents
Get the open-source security answers you need

Join 4,500+ Linux & Open Source Professionals!

2x a month. No spam.