Passwords beyond 256 bytes unlock locked accounts, root included, on OpenSSH servers using musl
A combination of choices in the musl C library and in OpenSSH sat unnoticed for almost ten years in systems such as Alpine Linux.
Researcher Özgün Kültekin has found a flaw that lets an attacker get into certain Linux systems over SSH by typing a password of 257 to 1,024 characters, The Register reports. The problem, dubbed *sshole, affects systems that use the lightweight musl C library instead of the GNU library glibc, and where the SSH server runs without PAM and with password login enabled. It concerns precisely the accounts that are not supposed to accept a password at all, such as root or users who only log in with keys.
The cause lies in an asterisk. Instead of a password hash, locked accounts often simply have a * in the password file. Musl also returns a * when its crypt function fails, and that is exactly what happens with passwords above 256 bytes, the German blog Linux und Ich explains. Both choices date from 2012. When OpenSSH closed a timing leak in 2016, the server started checking a password for such accounts too. Since then, in that situation OpenSSH compares an asterisk with an asterisk and lets the visitor in.
Ordinary desktops and servers running Ubuntu, Debian or Arch are not at risk, because they use glibc and PAM by default. Embedded systems, routers and containers may be vulnerable, however, and above all Alpine Linux, which uses musl as its standard library and provides official cloud images for AWS and Azure, according to The Register. OpenSSH released version 10.6p2 with a fix on Thursday.