OpenSSH 10.6p2: anyone can log in to some Alpine servers. Check whether yours is one
OpenSSH released 10.6p2 on November 5 with an emergency fix, and Alpine published its advisory the same day. On an affected machine, Alpine says, “an attacker who can reach your SSH port can log in without knowing any password. It takes one connection, works every time, and needs no retries.” There’s no CVE number yet. OpenSSH’s Damien Miller told users to turn off password logins immediately.
It only hits a narrow set of machines. Ubuntu, Debian, RHEL, Rocky, macOS and Windows aren’t affected, and neither is Alpine with PAM turned on.
How it works
When sshd is built without PAM, it checks a password by running it through the C library’s crypt() and comparing the result to the stored hash. musl’s crypt() returns * as an error when the password is longer than 256 bytes. * is also exactly what /etc/shadow holds for an account with no password. So a long enough password “matches” every passwordless account, and sshd lets it in.
You’re affected only if all of these are true
- The machine uses musl, which in practice means Alpine (3.16 through 3.24 and edge).
- sshd checks passwords without PAM: Alpine’s default
openssh-serverpackage, oropenssh-server-pamwithUsePAM no. PasswordAuthenticationisyes, which is OpenSSH’s default.- An account that can log in has
*in its password field, and the machine has at least one account with a$5$or$6$hash.
Root is safe on the defaults. OpenSSH’s PermitRootLogin prohibit-password keeps password logins off root unless someone set PermitRootLogin yes. Accounts locked with ! aren’t affected, and neither are containers that don’t run sshd.
What I saw in the lab
I put openssh-server in an Alpine 3.24 container on my Rocky lab VM and ran the checks below. Alpine’s repo already served the fixed package, 10.3_p1-r2. Root had * in its password field, and a user I made with adduser -D had !, which is locked and not affected. A build without PAM doesn’t print a usepam line in sshd -T at all. No line means no PAM. I didn’t try the bypass itself.
Check one host
cat /etc/alpine-release # no file: not Alpine
apk info -v | grep '^openssh-server' # compare with the table below
sshd -T | grep -Ei '^(usepam|passwordauthentication|permitrootlogin) '
awk -F: '$2=="*" {print $1}' /etc/shadow # accounts with no password
If sshd -T shows passwordauthentication yes and either no usepam line or usepam no, the host is exposed until it has the fixed package. To see whether someone already got in, Alpine says to look in /var/log/messages for Accepted password for an account that has no password.
Check the containers on a Linux host
Your Linux hosts aren’t affected, but Alpine containers running sshd on them can be. This lists every running Alpine container that’s running sshd, with its package version (swap podman for docker if that’s what you use):
for c in $(podman ps -q); do
podman exec "$c" sh -c '[ -f /etc/alpine-release ] && pgrep sshd >/dev/null && apk info -v 2>/dev/null | grep "^openssh-server-[0-9]"' 2>/dev/null \
| sed "s|^|$(podman inspect -f '{{.Name}}' "$c"): |"
done
I tested it with one Alpine container running sshd and one not. It listed only the first.
Fixed packages
| Alpine | Fixed openssh-server |
|---|---|
| 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 |
What to do
- Update:
apk upgrade -U -a, thenrc-service sshd restart. The restart matters. The running sshd keeps the old code until it restarts. - If you can’t update right now, add
PasswordAuthentication noto/etc/ssh/sshd_configand restart sshd. Make sure you have a working SSH key first. - For containers, rebuild the image on the fixed package, or take sshd out of it.
- Check
/var/log/messagesfor password logins to accounts that have no password.
Doing it with RFF
The RFF Linux agent runs on glibc distributions, so it doesn’t run on an Alpine host itself. On the Ubuntu, Debian and RHEL-family hosts it does manage, you can run the container loop above as a script job on every host at once and get back which containers need a rebuild.
RFF is free for your first 100 endpoints: getrff.com.
Sources
- Alpine Linux: openssh-server password authentication bypass (the cause, affected setups, fixed packages, the log check)
- Damien Miller on the 10.6p2 release (turn off password logins immediately)
- heise: OpenSSH and Alpine Linux warn of severe but niche bug (musl without PAM only; not glibc, not PAM)
Comments
Comments use GitHub Discussions, so you'll need a GitHub account to post. Corrections are especially welcome.