Alpine Linux OpenSSH Vulnerability: Patch and Check10 min read2,040 words

Alpine Linux OpenSSH Vulnerability: Patch and Check

Learn which Alpine Linux and musl-based systems may be exposed to the OpenSSH flaw, how to patch and restart sshd, and what to check for signs of compromise.

Alpine Linux OpenSSH vulnerabilityCVE-2026-123158OpenSSH security patchmusl Linux securitySSH password authentication
Alpine Linux OpenSSH Vulnerability: Patch and Check

Alpine Linux's OpenSSH Flaw: Who's at Risk and What to Do

An SSH vulnerability is especially worrying when it lets an attacker turn a reachable server into one they can access without a valid password. That's what CVE-2026-123158 is about: an issue in Alpine Linux (and potentially other systems built around the musl C library). Under a specific mix of OpenSSH settings and account states, someone who can reach SSH may be able to log in to accounts that were meant to be key-only.

That doesn't mean every Alpine server is compromised. The flaw only applies when particular prerequisites are present. If password authentication is turned off, or if the relevant PAM configuration is in place, you're not exposed through this specific issue. Still, those prerequisites can show up in defaults or in automated deployments, including some Alpine cloud images. And don't overlook the "restart" part: upgrading the package alone won't fix a running instance. The SSH daemon has to be restarted for the change to take effect.

This guide walks through how the bypass works, how to check whether you're actually exposed, how to apply Alpine's fix safely, and what to look for if you suspect someone already got in. The priority is simple: find reachable affected hosts, patch and restart them, then review authentication evidence.

How does the Alpine OpenSSH flaw work?

CVE-2026-123158 is an authentication bypass caused by an unexpected interaction between OpenSSH and musl's crypt() function. It depends on a particular setup:

  • OpenSSH built without PAM
  • Password authentication enabled
  • Accounts whose password field contains * (a common marker for an account that has no usable password)

In that setup, sshd checks a password attempt by hashing it with the system's C library and comparing the result to the account's stored password field. For certain unusually long password attempts, musl's crypt() can return * as an error value. Since * is also the stored value for a passwordless account, the comparison can succeed even though it shouldn't.

The attacker doesn't need the victim's intended SSH key. The requirements, as described in the advisory, include:

  • A password attempt between 257 and 1,024 bytes long
  • The name of a passwordless account
  • At least one other account on the system with a $5$ or $6$ password hash

Alpine notes that if you have even one account with such a hash, that condition can end up satisfying the "for all passwordless accounts" part for the host.

So the core point is this: long passwords alone don't make every Linux SSH server vulnerable, and having passwordless accounts alone isn't enough either. The issue only becomes exploitable when the vulnerable OpenSSH build, musl behavior, SSH configuration, and account records line up.

Why this is not a generic Linux OpenSSH flaw

Most Linux distributions use glibc, not musl. In the same error scenario, glibc's crypt() returns NULL, which sshd rejects. That's why the issue isn't treated as a blanket vulnerability across distributions like Debian, Ubuntu, or Fedora.

The underlying behavior has been reported as present since 2016. That age doesn't make it "safe," exactly - it just means the bug can sit quietly until a particular combination of builds and configuration turns it into something an attacker can use.

Operational takeaway: you have to check the exact OS image, the OpenSSH package/build, the authentication settings, and what's actually in the account records. Don't assume exposure just because the SSH port is open - but if a reachable host matches the prerequisites, treat it as urgent.

Which Alpine and musl systems may be exposed?

Alpine reports the affected releases it checked include:

  • 3.21 through 3.24
  • The edge branch
  • Older branches from 3.16 through 3.20

Fixes have been published for supported releases and for backports to 3.16. Since package availability can change, use the advisory and the repository state for the branch you run rather than relying only on the version number.

Exposure depends on all of these conditions being true:

  • The host runs the affected openssh-server package built without PAM, or openssh-server-pam with UsePAM no.
  • OpenSSH has PasswordAuthentication yes (default in many setups unless an image/config changes it).
  • At least one account has * in its password field.
  • At least one other account has a $5$ or $6$ password hash.
  • An attacker can reach the SSH service and knows the name of a passwordless account.

Alpine's tiny-cloud images are worth extra scrutiny. Alpine says versions 3.18.11 through 3.24.3 include an alpine account with a * password field and passwordless doas. Alpine also says these images are safe on first boot, but they can become exposed once a suitable password hash exists. Setting a console password or adding a user with a hashed password can create that condition - so something that looked safe during initial provisioning may not stay safe after later configuration.

Root is not typically the exposed path. With OpenSSH's default PermitRootLogin prohibit-password, password-based root login is blocked. But that doesn't fully remove the risk: an accessible account that can become root (for example, via doas) can still provide a route to elevated access.

Systems Alpine says are not affected

This doesn't apply in the described way to:

  • Containers that don't run sshd
  • Systems with password authentication disabled
  • Systems using openssh-server-pam with UsePAM yes

Accounts locked with ! in the password field are also not the same as the passwordless * case in the advisory. Alpine also says cloud images configured through cloud-init aren't affected because cloud-init writes PasswordAuthentication no.

Other musl-based operating systems - Adélie Linux, Void Linux, Sabotage Linux, OpenWrt, and systems built with Yocto - may warrant review. Just don't assume "it uses musl" means you're exposed. The OpenSSH build and SSH configuration have to match too. Wind River says it's assessing the issue for Wind River Linux.

How do you patch Alpine Linux and restart SSH?

Alpine has released the fix in updated packages, including:

  • 3.21.10
  • 3.22.8
  • 3.23.8
  • 3.24.4

Fixed packages were also published for older branches back to 3.16. The OpenSSH 10.6p2 release also addresses the issue in sshd, and Alpine stable branches include a patch for the same problem.

On an Alpine host, upgrade with:

apk upgrade -U -a

Then restart the SSH daemon:

rc-service sshd restart

The restart matters. Upgrading replaces files on disk, but it doesn't automatically swap out the sshd process that's already running. Until you restart, the server may keep using the vulnerable code.

Apply the fix without locking yourself out

Before changing SSH access on a remote server, make sure you have a recovery path. If you're temporarily disabling password authentication, confirm key-based login still works from a separate session first. Keep an existing administrative session open while you test the new connection - especially on a cloud host where console recovery can take time.

If you can't update immediately, you can set PasswordAuthentication no in the effective sshd configuration and restart sshd after confirming key access. Don't assume a single file contains the final setting; included configs and provisioning tools can change the effective value.

A practical rollout sequence looks like this:

  1. Inventory Alpine and musl-based hosts that run sshd, including cloud images and embedded devices.
  2. Prioritize internet-reachable systems and hosts with password authentication enabled.
  3. Confirm key-based administrative access works before changing authentication settings.
  4. Install the fixed package (or apply the temporary configuration mitigation).
  5. Restart sshd and verify that the updated daemon accepts a known-good login.
  6. Record the package version, configuration state, restart time, and any hosts you couldn't update.

One more constraint to keep in mind: Alpine 3.21 reached end of support on November 1. A fixed package can address this vulnerability, but an unsupported branch can bring extra maintenance risk beyond this single issue. Where possible, fold an upgrade to a supported Alpine branch into the remediation plan instead of treating this patch as a long-term substitute for ongoing updates.

How should you investigate possible access?

Patching stops the known bypass from working in the future, but it won't tell you whether anyone already exploited it. Alpine recommends checking /var/log/messages for Accepted password for entries that mention an account with no password. Review the relevant time window for unexpected successful logins, particularly on systems where SSH was reachable from untrusted networks.

A successful login in the logs is evidence to dig into - not a complete incident timeline. Log retention may be limited, and an attacker with access could alter local records. Compare what you find locally with centralized logging, cloud audit logs, and firewall/VPN records and deployment data your team already has.

You should also look for signs of privilege escalation or persistence. Alpine specifically suggests checking doas usage, recently created users, newly added files, and changes to authorized_keys. Focus on changes that don't match your deployment process or an administrator's documented work. If the system is managed with configuration management, compare the running state to what you expect - not what you remember.

When to treat the host as compromised

If you see a successful password login to a passwordless account, unexpected privilege escalation, or unexplained persistence changes, assume the host may be compromised until you can rule it out. What you do next depends on the server's role and what the evidence shows, but commonly it means isolating it from untrusted access, preserving logs and relevant disk or cloud snapshots, and rotating credentials that may have been exposed.

And don't treat a package upgrade as the end of the incident response. If an attacker got in before the restart, the patched daemon doesn't magically undo accounts, keys, scripts, or other changes they may have left behind. For sensitive data systems or production workloads, loop in your security or incident-response team and follow your organization's evidence-handling process.

Key takeaways:

  • This vulnerability needs a specific combination of musl, OpenSSH build/settings, and account records.
  • Patch the package and restart sshd; both steps matter.
  • If patching is delayed, disable password authentication only after verifying key access.
  • Review successful logins, then check doas, file changes, and key/auth changes.
  • If you can't rule out access, treat the machine as potentially compromised.

Conclusion

CVE-2026-123158 is a narrow, configuration-dependent flaw with a potentially serious outcome: passwordless accounts can become reachable over SSH when the right conditions are present. That's why scoping matters more than either dismissing it as obscure or assuming every Linux server is impacted.

Identify Alpine and musl-based hosts running sshd, verify their package and effective authentication settings, install the fix, and restart the daemon. Then check authentication and system-change records for signs that someone got in before the change. The difference between "the package is updated" and "the vulnerable process is no longer running" is operationally important - make sure both are true before you consider remediation complete.

Frequently Asked Questions

No. The host must meet the specific OpenSSH, PAM, password-authentication, and account-state conditions. Systems with password authentication disabled or openssh-server-pam configured with UsePAM yes are not affected through the described path. Check the actual running configuration and package, not just the distribution name.
The reported bypass depends on musl returning * for the relevant crypt() error case. The glibc behavior used by most Debian, Ubuntu, and Fedora systems returns NULL, which sshd rejects. The issue is therefore not considered a general vulnerability in those distributions, though normal security updates still apply.
Not by itself. After upgrading, restart the SSH daemon with rc-service sshd restart so the running process loads the patched code. Confirm that the restart succeeded and test a fresh SSH connection. Keep a recovery session available when making changes to a remote server.
Set PasswordAuthentication no and restart sshd, but first verify that key-based login works. Then prioritize installing the fixed package. If the server may already have accepted an unauthorized login, investigate it as a possible compromise rather than relying only on the temporary configuration change.

Related articles