Skip to content

Defender Daily

OpenSSH flaw lets attackers log in to musl Linux accounts with a long password

· Updated

Affected
OpenSSH before 10.6p2 on musl Linux without PAM, including Alpine Linux 3.16 through 3.24 and edge. All versions and fixes

Update, : Previdian says its sensors recorded 20 exploit attempts from 13 IP addresses from Nov 6 to Nov 8. Its founder, Ryan Dewhurst, told Help Net Security that one attempt got root on a Previdian honeypot running Alpine Linux and OpenSSH.

On musl-based Linux without PAM, OpenSSH’s server lets an attacker who can reach the SSH port log in to an account with no password, using a password over 256 bytes. Alpine Linux says it takes one connection and works every time. OpenSSH released 10.6p2 with a workaround on Nov 5, and Alpine published fixed packages for every release back to 3.16. Exploit code is public, and Previdian says its sensors have recorded exploit attempts since Nov 6.

Without PAM, sshd checks a password by hashing it with the C library’s crypt() and comparing the result with the stored password field. For an account whose field holds no real hash, sshd borrows another account’s salt, Alpine explains. With a SHA-256 or SHA-512 salt and a key over 256 bytes, musl’s crypt() fails and returns * as its error string. That is exactly what the field holds for an account with no password, so the login succeeds. OpenSSH says the root cause lies outside sshd but can be avoided there.

Alpine lists the conditions. Its main openssh-server package is built without PAM, and the PAM build is affected when UsePAM is set to no. Password authentication must be on, which is OpenSSH’s default. An account must have * as its password field, and at least one other local account a SHA-256 or SHA-512 hash. Root ships with * in Alpine’s base image, but OpenSSH’s default prohibit-password setting keeps root out unless another reachable account can become root.

Other exposed accounts include key-only users made with adduser and no password, and directory users served through musl-nscd. Alpine’s tiny-cloud images from 3.18.11 through 3.24.3 ship an alpine user with no password and passwordless doas. Once any SHA-512 hash exists on such a machine, an attacker can log in as alpine and use doas to become root. Containers that don’t run sshd, and images configured by cloud-init, which turns password logins off, aren’t affected.

Özgün Kültekin of Wakefield reported the flaw. Kültekin’s write-up names OpenWrt, Buildroot, Yocto and many Docker images as musl-based systems that run OpenSSH. None of the sources says which of those builds have shipped fixes, and neither OpenSSH nor Alpine says how many systems are exposed.

Vendor
OpenSSH

What to do

5 steps

Affected and fixed versions

  • Product
    OpenSSH portable, on Linux with musl and PAM off
    Affected
    Before 10.6p2
    Fixed
    10.6p2 or later
  • Product
    Alpine Linux edge
    Affected
    Earlier openssh packages
    Fixed
    10.6_p2-r0
  • Product
    Alpine Linux 3.24
    Affected
    Earlier openssh packages
    Fixed
    10.3_p1-r2
  • Product
    Alpine Linux 3.23
    Affected
    Earlier openssh packages
    Fixed
    10.2_p1-r1
  • Product
    Alpine Linux 3.22
    Affected
    Earlier openssh packages
    Fixed
    10.0_p1-r11
  • Product
    Alpine Linux 3.21
    Affected
    Earlier openssh packages
    Fixed
    9.9_p2-r1
  • Product
    Alpine Linux 3.20
    Affected
    Earlier openssh packages
    Fixed
    9.7_p1-r6
  • Product
    Alpine Linux 3.19
    Affected
    Earlier openssh packages
    Fixed
    9.6_p1-r3
  • Product
    Alpine Linux 3.18
    Affected
    Earlier openssh packages
    Fixed
    9.3_p2-r4
  • Product
    Alpine Linux 3.17
    Affected
    Earlier openssh packages
    Fixed
    9.1_p1-r7
  • Product
    Alpine Linux 3.16
    Affected
    Earlier openssh packages
    Fixed
    9.0_p1-r6

Timeline

  1. Nov 5OpenSSH releases 10.6p2 with the workaround, and Alpine publishes its advisory and fixed packages.
  2. Nov 6Previdian’s sensors record the first exploit attempts against the flaw.

Sources

Subscribe

Get the Daily Brief by email

Weekdays at 7am ET.

We’ll email you a link to confirm. Unsubscribe from any email.