OpenSSH on Alpine: a long password gets in. Are you exposed?

On Alpine and other musl systems without PAM, sshd accepted a very long password for accounts that have none. Install the fixed openssh package and restart sshd, or turn off password logins.

Published 8 min read#Security updates#App security

If you run an Alpine Linux server, or a Docker image based on it that starts sshd, this flaw is about you. The OpenSSH release notes say OpenSSH 10.6p2 came out on 2026-11-05 with a critical security workaround for Linux systems that use musl libc with PAM disabled, and Alpine is built on musl libc. By the end of this article you will know in a minute whether your server is exposed, which package closes the flaw on your branch, and why the update alone is not enough.

What does CVE-2026-123158 do in sshd?

CVE-2026-123158 lets sshd on Linux with musl libc and without PAM accept a very long password for an account that has no password at all. Anyone who can reach your SSH port gets in without knowing any password.

According to the Alpine security advisory, the attack takes one connection and works every time, with no retries. The attacker needs the name of an account whose password field is *, and the machine needs one other account with a $5$ or $6$ password hash. The attacker then sends a password of 257 to 1024 bytes. One user with a password is enough to make every account without one reachable.

The CVE record says that for some account configurations, any password between 256 and 1024 characters succeeds. In the same record, MITRE scores it 8.1 HIGH on CVSS 3.1, and the CISA assessment next to it lists the exploitation status as poc, a proof of concept. That is all the official record says about exploitation so far. The OpenSSH team writes in the release notes that the root cause is outside sshd, but the flaw is exploitable through sshd and sshd can avoid it.

Why does a long password open an account with no password?

Because musl's crypt() returns the string * as an error indicator when the password is over 256 bytes long, and * is exactly what is stored in the password field of every account with no password. The comparison matches, and the login succeeds.

Without PAM, sshd checks the password itself. It runs the attempt through crypt(), the C library function that turns a password into its stored hash, and compares the result with the stored field. For an account whose stored field is too short to hold a salt (the random prefix of a hash), sshd borrows the salt of another account. That is where the second condition in the Alpine advisory comes in: an account on the machine with a $5$ or $6$ hash.

So the error value and the "no password" value became the same string, and the comparison cannot tell them apart. The OpenSSH commit that closes it adds one condition before a match is accepted: the stored field must be at least 4 characters long (MIN_PASSWORD_HASH_LEN), so a lone star no longer passes.

If you want to see how passwords should be stored in your own app, we have an article on storing user passwords with Argon2id.

Who is exposed on Alpine?

An Alpine server is exposed when four conditions meet: sshd without PAM, password logins on, an account whose password field is *, and another account with a $5$ or $6$ hash.

In detail, per the Alpine advisory:

  1. You run the regular openssh-server package, which is built without PAM, or openssh-server-pam with UsePAM no. openssh-server-pam with UsePAM yes is not exposed.

  2. PasswordAuthentication is yes, the OpenSSH default unless you changed it.

  3. An account has * as its password field: for example root, which ships as root:* in the base image since about Alpine 3.16, a key-only user whose field was set with usermod -p '*', and the alpine user in the official tiny-cloud images.

  4. At least one local account has a $5$ or $6$ hash.

The default PermitRootLogin prohibit-password protects root on its own, unless you set PermitRootLogin yes. That protection does not help if another account that can log in is able to become root, for example through doas.

Affected releases: every release Alpine checked, 3.21 through 3.24 and edge, plus the older releases from 3.16 to 3.20 that no longer get regular updates.

The official tiny-cloud images from 3.18.11 through 3.24.3 ship an alpine user with a * password field and passwordless doas. They are safe on first boot, and become exposed as soon as any $6$ hash exists on the machine, for example when an admin sets a console password. The attacker then logs in as alpine and becomes root with doas.

Who is not exposed?

  • Docker containers that do not run sshd.

  • Servers with PasswordAuthentication no.

  • openssh-server-pam with UsePAM yes.

  • Locked accounts, with ! as the password field in /etc/shadow: they cannot log in with a password or a key.

  • Servers where no account has a password hash starting with $.

  • Cloud images configured through cloud-init, because it writes PasswordAuthentication no.

How do you check your server in a minute?

The check is four commands you run as root, one per condition. If all four come back true, your server is exposed.

# 1) which sshd package, and which version
apk list -I 'openssh-server*'

# 2) password logins and PAM (with openssh-server-pam, run sshd.pam -T)
sshd -T | grep -iE '^(usepam|passwordauthentication)'

# 3) accounts whose password field is *
awk -F: '$2 == "*" {print $1}' /etc/shadow

# 4) accounts with a $5$ or $6$ hash
awk -F: '$2 ~ /^\$[56]\$/ {print $1}' /etc/shadow
  1. If the first command shows openssh-server without -pam, the first condition is true. If it shows openssh-server-pam, the program is /usr/sbin/sshd.pam according to the package file list, so run sshd.pam -T instead of sshd -T and look for usepam no.

  2. If the second command prints passwordauthentication yes, the second condition is true.

  3. If the third and fourth commands print names, the last two conditions are true.

Users that come from a directory service through musl-nscd have no line in /etc/shadow, so the third command will not list them, and the Alpine advisory counts them among the accounts with a * field. If sshd runs inside a container, run the same commands inside it with docker exec.

Which openssh version closes the flaw on your branch?

Each Alpine branch has its own fixed version of the openssh package. Edge got OpenSSH 10.6p2, and the stable branches got a patch for the same problem on their own version. Your installed version should match the table or be newer:

Alpine branch

Fixed openssh version

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

3.20

9.7_p1-r6

3.19

9.6_p1-r3

3.18

9.3_p2-r4

3.17

9.1_p1-r7

3.16

9.0_p1-r6

The CVE page on the Alpine security tracker shows the same fixed versions from edge to 3.19, and the advisory goes on to 3.16. Alpine 3.21.10, 3.22.8, 3.23.8 and 3.24.4 contain the fixed package. Branch 3.21 reached its end of support on 2026-11-01, but Alpine published fixed packages for every branch back to 3.16.

Why do you have to restart sshd after the update?

Updating the openssh package does not replace the sshd that is running now, so the old version keeps running, flaw included, until you restart it.

This is the full update on a server:

apk upgrade -U -a
rc-service sshd restart
apk list -I 'openssh-server*'

The first command, from the Alpine advisory, refreshes the package index and upgrades the installed packages, the second restarts sshd, and the third prints the version so you can compare it with the table.

What if sshd runs inside a Docker image?

An update inside a running container is gone as soon as the container is recreated from its image, so the lasting fix belongs in the image itself. Rebuild it without the cache, so the apk add step installs the fixed package instead of reusing an old layer, then start the container from the new image and check the version inside it:

docker build --pull --no-cache -t my-sshd-image .
docker exec my-sshd apk list -I 'openssh-server*'

If you cannot update yet

Turn off password logins: per Alpine, PasswordAuthentication no closes the flaw on its own. Before you start, make sure your SSH key login works, and keep your current session open until you have tested a new login. These are the advisory's own commands, run as root:

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. Alpine's default sshd configuration reads the sshd_config.d directory from 3.19 onward, and older releases ignore it. That is why the sed command also edits /etc/ssh/sshd_config itself and saves the original as /etc/ssh/sshd_config.bak. If you have openssh-server-pam, write sshd.pam instead of sshd in the last two lines.

How do you know if someone got in?

Look in /var/log/messages for sshd lines reading Accepted password for an account that has no password, such as alpine, root or any key-only user.

grep 'Accepted password for' /var/log/messages

Then review doas use and recently added users, files and authorized_keys entries on exposed servers. The Alpine advisory is direct: if you cannot rule out a login, treat the machine as compromised. In that case every secret that lived on it, such as API keys and database passwords, has to be replaced, and we wrote about the order to rotate secrets after the Railway breach.

Where do you start now?

Start with the server whose SSH port is open to the internet, then every container that runs sshd.

  1. Run the four check commands, and you will know whether the conditions meet.

  2. Update openssh to the version in the table and restart sshd, or set PasswordAuthentication no if the update has to wait.

  3. Check /var/log/messages for Accepted password for on accounts with no password.

If you want to follow flaws like this one that touch your servers, all the security updates are in one place. And if you have a full platform and want someone to test it, Muhassan finds the flaws in your platform before anyone else does, and hands you a clear fix plan. How many of your servers still accept password logins?

FAQ

My Docker image is based on Alpine. Am I exposed?

Only if the container runs sshd. The Alpine advisory says Docker containers that do not run sshd are not affected. If yours does, check the four conditions inside it and rebuild the image with the fixed package.

I only log in with an SSH key. Do I need to do anything?

Yes, unless PasswordAuthentication is off. A key-only account often has a star in its password field, and that is exactly the account the attack opens while password logins are on.

My server is not Alpine. Does this flaw affect me?

Only if your system uses musl libc and sshd runs without PAM, because the OpenSSH release notes and the CVE record tie the flaw to those two conditions. Otherwise this flaw does not apply to your server.

My Alpine is 3.21 or older. Is there a fix for it?

Yes. Branch 3.21 reached its end of support on 2026-11-01, but Alpine published fixed packages for every branch back to 3.16. Update the package now, then plan a move to a supported branch.

What happens if I turn off password logins?

Password logins stop for every account, and key logins keep working. That is why Alpine asks you to confirm your key login works and to keep your session open until a new login succeeds.

Share

More articles