---
title: "OpenSSH CVE-2026-123158 (SSHole) Password Authentication Bypass on Alpine and musl: Fix and Mitigation"
canonical: "https://techwiki.co.uk/linux/openssh-cve-2026-123158-sshole-alpine-musl"
author: "Adam Birds"
article_type: "documentation"
published: "2026-12-01T00:24:59.273Z"
updated: "2026-12-01T00:24:59.273Z"
categories: ["Linux"]
tags: ["alpine","docker","openssh","security"]
---**On musl-based systems such as Alpine Linux, sshd without PAM can let an attacker log in to accounts that have no password. These are accounts whose `/etc/shadow` password field is `*`. The attacker sends an arbitrarily chosen password longer than 256 bytes. One attempt is enough, and no credentials are needed.**

CVE-2026-123158 ("SSHole") is rated CVSS 3.1 8.1. A public proof of concept has existed since disclosure on 5 November 2026. Treat internet-facing Alpine hosts and containers that run sshd as urgent.

## Cause

musl's `crypt()` refuses passwords longer than 256 bytes and returns the string `*`. On a key-only account the stored password field is also `*`. sshd without PAM compares the two strings, finds they match, and accepts the login. OpenSSH 10.6p2 now rejects stored hashes that are too short to be valid.

## Who is affected

A host is exposed only when **all** of the following are true:

- The system uses **musl libc**: Alpine, OpenWrt, Buildroot, some Yocto builds, or other minimal or embedded distributions.
- sshd is built or configured **without PAM**. Alpine's `openssh-server` package is non-PAM by default.
- `PasswordAuthentication` is enabled. This is the default on Alpine.
- At least one account has `*` as its password field. Typical examples are key-only users, directory-backed users, and the default cloud-image user on some Alpine images.
- At least one other local account has a real password hash.

The following are **not** affected: glibc distributions (Debian, Ubuntu, RHEL, Fedora), sshd using PAM (`openssh-server-pam` with `UsePAM yes`), servers with `PasswordAuthentication no`, accounts locked with `!`, Dropbear, and containers that do not run sshd.

## Check a host

### Check the C library and the OpenSSH package

```bash
ldd --version 2>&1 | head -1
apk info -v openssh-server 2>/dev/null
```

### Check the effective sshd settings

```bash
sudo sshd -T | grep -E '^(passwordauthentication|kbdinteractiveauthentication|usepam|permitrootlogin) '
```

### List accounts with a `*` password field

```bash
sudo awk -F: '$2=="*" {print $1}' /etc/shadow
```

## Fix: upgrade OpenSSH

Upstream fixed this in Portable OpenSSH **10.6p2**. Alpine backported the fix to every branch from 3.16 onwards:

| Alpine branch | Fixed `openssh` package |
|---|---|
| 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 |

Upgrade the packages, then restart sshd. A running daemon keeps the old code until it is restarted.

```bash
sudo apk upgrade -U -a
sudo rc-service sshd restart
```

Because the fixes are backports, the version in the SSH banner does not show whether a host is fixed. Compare the installed package revision with the table above.

### Docker and cloud images

Updating the host does not patch packages inside container images. Rebuild any image that installs `openssh-server` from a fresh base:

```bash
docker build --pull --no-cache -t <your-image>:<tag> .
```

Rebuild VM templates and golden images in the same way, or new instances will start out vulnerable.

## Interim mitigation: disable password authentication

If you cannot upgrade immediately, turn off password logins.

**First, confirm that key-based login works**, from a second session, so you do not lock yourself out. Then run:

```bash
printf 'PasswordAuthentication no\nKbdInteractiveAuthentication no\n' | sudo tee /etc/ssh/sshd_config.d/00-no-passwords.conf
sudo sshd -t && sudo rc-service sshd restart
```

sshd uses the first value it reads for each option, so a file named `00-...` in `sshd_config.d` overrides later settings. This relies on the main `sshd_config` containing `Include /etc/ssh/sshd_config.d/*.conf` near the top. If it does not, set the two options directly in `/etc/ssh/sshd_config`.

Also restrict port 22 to trusted networks, a VPN or a bastion host where possible.

## Verify

Check that password authentication is off in the running configuration:

```bash
sudo sshd -T | grep -E '^(passwordauthentication|kbdinteractiveauthentication) '
```

Both lines should read `no`. From another machine, confirm that the server offers only public-key authentication:

```bash
ssh -o PreferredAuthentications=none -o PubkeyAuthentication=no <user>@<server-ip>
```

The error should list only `(publickey)`.

## Look for signs of compromise

Any successful password login to an account that has no password is a strong sign of compromise:

```bash
sudo grep 'Accepted password for' /var/log/messages /var/log/auth.log 2>/dev/null
```

Compare the usernames against the `*` accounts listed earlier. If any match, treat the host as compromised. Review `authorized_keys` files, new accounts, cron jobs and service definitions, and look for unexpected outbound connections. Rebuilding the host is safer than cleaning it up.

## Notes

- With the default `PermitRootLogin prohibit-password`, root cannot log in directly with a password. Other `*` accounts can still be used. If any of them has passwordless `doas` or `sudo`, the attacker gets root.
- Avoid running unverified "checker" scripts that circulate for this CVE. Use the configuration and package checks above instead.
