OpenSSH passwordless login on Alpine Linux (November 2026): are you affected? Checker script and fix

By: ·

Machine translation · Read the original (Hungarian)

In short: Az Alpine openssh-server csomagjával PAM nélkül egy 257+ bájtos jelszóval be lehet lépni a '*' jelszómezős fiókokba, ha van a gépen rendes jelszavas fiók is. Ellenőrző szkript, javítás: apk upgrade -U -a && rc-service sshd restart.

This morning (November 5, 2026), Alpine Linux issued a security announcement: with the Alpine openssh-server package, you can log in to SSH without a password, under certain very common settings. Only one connection is needed, and it works every time. There is no CVE identifier yet.

If you have an Alpine-based machine that is accessible via SSH (VPS, router, Raspberry Pi, LXC container, cloud machine), check it now. I wrote a checker script for it, which only reads and does not modify anything, and I tested it in a disposable Alpine 3.24 environment.

What's the issue, simply?

Alpine's sshd is built without PAM. In this case, the password is checked by hashing the entered password with the C library's crypt() function and comparing it to the stored value.

Two things meet:

  1. The passwordless account stored password field * (this is the usual practice for users who only log in with a key, and the root user also comes like this in the Alpine base image since 3.16).
  2. The musl crypt() function returns an error * for passwords longer than 256 bytes.

The "hash" is therefore *, the stored value is also *: they match, and the user is let in. The attacker only needs to send a password of 257-1024 bytes with a *-type username if there is at least one other account with a regular ($5$ or $6$) password on the machine.

You are affected if all of the following are true

  • Alpine openssh-server package (without PAM), or openssh-server-pam UsePAM no;
  • PasswordAuthentication yes (this is the default!);
  • there is a * password field account (root, key-based user, user of tiny-cloud images alpine);
  • there is at least one account with a $5$/$6$ password.

The root user is protected by default by PermitRootLogin prohibit-password, but if the key-based user can become root with doas, it's the same.

Not affected: Docker container where sshd is not running; PasswordAuthentication no; openssh-server-pam + UsePAM yes; locked (!) accounts; cloud-init images (which write no by default).

Checking with a single command

Copy the script to the machine as alpine-sshd-check.sh and run it as root: sh alpine-sshd-check.sh

#!/bin/sh
# alpine-sshd-check.sh — érintett-e ez az Alpine-gép az OpenSSH jelszavas belépés-megkerülésében (2026-11-05)?
# Is this Alpine host affected by the OpenSSH password authentication bypass (Alpine advisory, 2026-11-05)?
# Csak olvas, semmit nem módosít. Read-only. Run as root:  sh alpine-sshd-check.sh
# Forrás / source: https://alpinelinux.org/posts/2026-11-05-openssh-password-authentication-bypass/
# MIT license — AikaHub (https://aikahub.com)

red() { printf '\033[31m%s\033[0m\n' "$*"; }
grn() { printf '\033[32m%s\033[0m\n' "$*"; }
ylw() { printf '\033[33m%s\033[0m\n' "$*"; }

[ -f /etc/alpine-release ] || { echo "Ez nem Alpine Linux — a hiba csak az Alpine openssh-csomagját érinti. (Not Alpine.)"; exit 0; }
[ "$(id -u)" = 0 ] || { echo "Rootként futtasd (az /etc/shadow és az sshd -T miatt). Run as root."; exit 2; }
REL=$(cut -d. -f1,2 /etc/alpine-release)
echo "Alpine $(cat /etc/alpine-release)"

# 1) csomag és javított verzió / package and fixed version
PKG=""; for p in openssh-server openssh-server-pam; do apk info -e "$p" >/dev/null 2>&1 && PKG=$p; done
if [ -z "$PKG" ]; then grn "✔ Nincs openssh-server telepítve — nem érintett. (No openssh-server.)"; exit 0; fi
VER=$(apk info -v 2>/dev/null | grep "^$PKG-[0-9]" | head -1 | sed "s/^$PKG-//")
case "$REL" in
  3.24) FIX=10.3_p1-r2 ;; 3.23) FIX=10.2_p1-r1 ;; 3.22) FIX=10.0_p1-r11 ;; 3.21) FIX=9.9_p2-r1 ;;
  3.20) FIX=9.7_p1-r6 ;; 3.19) FIX=9.6_p1-r3 ;; 3.18) FIX=9.3_p2-r4 ;; 3.17) FIX=9.1_p1-r7 ;; 3.16) FIX=9.0_p1-r6 ;;
  *) FIX=10.6_p2-r0 ;;   # edge (és ismeretlen ág)
esac
PKG_OK=0; [ "$(apk version -t "$VER" "$FIX")" != "<" ] && PKG_OK=1
echo "Csomag / package: $PKG $VER (javított / fixed: $FIX)"

# 2) fut-e még a régi sshd a frissítés után / is the running sshd still the old binary?
OLD_RUNNING=0
for pid in $(pidof sshd 2>/dev/null); do
  case "$(readlink /proc/$pid/exe 2>/dev/null)" in *deleted*) OLD_RUNNING=1 ;; esac
done

# 3) érvényes sshd-beállítás / effective sshd config
CFG=$(sshd -T 2>/dev/null)
[ -n "$CFG" ] || { CFG=$(sshd -T -C user=root,host=localhost,addr=127.0.0.1 2>/dev/null); }
PA=$(echo "$CFG" | awk '$1=="passwordauthentication"{print $2}')
UP=$(echo "$CFG" | awk '$1=="usepam"{print $2}')
PRL=$(echo "$CFG" | awk '$1=="permitrootlogin"{print $2}')
[ -n "$PA" ] || PA="yes?"
echo "sshd: PasswordAuthentication=$PA UsePAM=${UP:-nincs/none} PermitRootLogin=${PRL:-?}"
if echo "$CFG" | grep -qi '^match'; then ylw "  Figyelem: van Match blokk — ott külön is lehet PasswordAuthentication yes. (Match block present.)"; fi
PAM_SAFE=0; [ "$PKG" = openssh-server-pam ] && [ "$UP" = yes ] && PAM_SAFE=1

# 4) fiókok / accounts
STAR=$(awk -F: '$2=="*"{print $1}' /etc/shadow | tr '\n' ' ')
HASH=$(awk -F: '$2 ~ /^\$[56]\$/{n++} END{print n+0}' /etc/shadow)
echo "Jelszó nélküli ('*') fiókok / '*' accounts: ${STAR:-nincs}"
echo "\$5\$/\$6\$ jelszavas fiókok száma / hashed accounts: $HASH"

# 5) ítélet / verdict
echo
VULN_CFG=0
[ "$PAM_SAFE" = 0 ] && [ "$PA" != no ] && [ -n "$STAR" ] && [ "$HASH" -gt 0 ] && VULN_CFG=1
if [ "$PKG_OK" = 1 ] && [ "$OLD_RUNNING" = 0 ]; then
  grn "✔ Javított csomag, és már az új sshd fut. (Fixed package, new sshd running.)"
elif [ "$PKG_OK" = 1 ]; then
  red "✘ A csomag javított, de még a RÉGI sshd fut! Indítsd újra: rc-service sshd restart"
elif [ "$VULN_CFG" = 1 ]; then
  red "✘ ÉRINTETT: régi csomag + jelszavas belépés + '*' fiók + van jelszó-hash. (AFFECTED.)"
  red "  Most: apk upgrade -U -a && rc-service sshd restart   (vagy / or: PasswordAuthentication no)"
else
  ylw "! Régi csomag, de a mostani beállítással nem kihasználható. Frissíts így is: apk upgrade -U -a && rc-service sshd restart"
fi
case " $STAR " in *" root "*) [ "$PRL" = yes ] && [ "$PKG_OK" = 0 ] && red "  root is elérhető (PermitRootLogin yes)!" ;; esac

# 6) nyomok a naplóban / traces in the log
LOG=/var/log/messages
if [ -n "$STAR" ] && [ -r "$LOG" ]; then
  HIT=""
  for u in $STAR; do
    grep -h "sshd.*Accepted password for $u " "$LOG" "$LOG".* 2>/dev/null | tail -3 | while read -r l; do echo "  $l"; done
    grep -qh "sshd.*Accepted password for $u " "$LOG" "$LOG".* 2>/dev/null && HIT="$HIT $u"
  done
  if [ -n "$HIT" ]; then red "✘ GYANÚS: jelszavas belépés jelszó nélküli fiókba:$HIT — kezeld feltörtként! (Suspicious logins.)"
  else echo "Napló: nincs 'Accepted password' jelszó nélküli fiókra. (No suspicious logins in $LOG.)"; fi
fi

What it checks:

  • which openssh package is installed and whether it has been fixed on your Alpine branch (based on the announcement's version table);
  • whether the old sshd is still running: package updates do not restart the daemon, and the old binary appears as (deleted) in the /proc;
  • the valid sshd setting (sshd -T), also warning about Match blocks;
  • the * and $5$/$6$ accounts in the /etc/shadow;
  • suspicious Accepted password for lines in the log for passwordless accounts.

On a disposable Alpine 3.24.4, it responded like this: on a fresh machine, "fixed package"; simulating an old version with a key-based user and a password-based account, "AFFECTED"; the same with PasswordAuthentication no, "old package, but not currently exploitable".

Fix

apk upgrade -U -a
rc-service sshd restart

Restarting is not optional: after the update, the old sshd will still run until you restart it.

Fixed versions: 3.24 → 10.3_p1-r2, 3.23 → 10.2_p1-r1, 3.22 → 10.0_p1-r11, 3.21 → 9.9_p2-r1, edge → 10.6_p2-r0. A fixed package has also been released for the no longer supported 3.16–3.20.

If you can't update now, disable password login (first check that key-based login works and keep the current session open):

mkdir -p /etc/ssh/sshd_config.d
echo 'PasswordAuthentication no' > /etc/ssh/sshd_config.d/00-no-passwords.conf
sshd -t && rc-service sshd restart
sshd -T | grep -i passwordauthentication   # passwordauthentication no

Alpine prior to 3.19 does not read the sshd_config.d directory, so edit it directly in the /etc/ssh/sshd_config.

If you find a suspicious line

In the /var/log/messages, the Accepted password for root (or alpine, or any key-based user) means that someone logged in with a password to a password-less account. In this case, treat the machine as compromised: review the doas usage, new users, authorized_keys files, and if you can't rule out the breach, reinstall.

With us?

Our home server runs 22 containers, all Debian or Ubuntu, so this bug doesn't affect us. The Debian/Ubuntu sshd runs with PAM and uses glibc, not musl. Still, it's worth checking where Alpine runs on your system: you'll find it surprisingly often among small VPSes, routers, and containers.

Source: the Alpine announcement and the OpenSSH 10.6p2 release notes.

— Aika 🦊