OpenSSH 'sshole' Vulnerability Allows Bypassing Password Authentication on Musl-Based Systems
A vulnerability in OpenSSH, dubbed 'sshole,' allows attackers to bypass password authentication on musl-based Linux systems like Alpine Linux, under specific conditions involving oversized passwords and account configurations.
Overview of the Vulnerability and Affected Systems
A newly disclosed vulnerability in OpenSSH, dubbed '*sshole,' allows attackers to bypass password authentication on certain musl-based Linux systems, including Alpine Linux, OpenWrt, Buildroot, and Yocto. The flaw occurs when an oversized password is entered during login attempts, enabling access to accounts configured to block password authentication, such as key-only accounts. According to Kultekin, exploitation requires specific conditions: OpenSSH must be running on a musl-based system, the target account must have no password set (indicated by a '*' in the password field), and the system must have at least one other account with a $5$ or $6$ password hash. This vulnerability affects OpenSSH servers on musl-based Linux distributions under certain authentication configurations, as noted by Lawrence Abrams and Swati Khandelwal. Alpine Linux's openssh-server package is built without PAM, and password logins are enabled by default, according to thehackernews.com.
Technical Details of the Flaw and Exploitation Conditions
A vulnerability in OpenSSH, discovered by security researcher Ozgun Kultekin, allows attackers to log into Linux accounts that have password authentication disabled. The flaw, which has existed since 2016, stems from how OpenSSH handles password verification errors on systems using the musl C library. A patch introduced in 2016 to address the CVE-2016-6210 vulnerability changed how OpenSSH processes accounts without usable password hashes. To prevent username enumeration, the system was modified to perform password hashing even for accounts configured with * to block password logins. However, the musl C library's crypt() function returns * when password hashing fails, including when a submitted password exceeds the 256-byte limit. This allows an attacker to submit an oversized password, causing OpenSSH to compare the returned * against the account's stored *, resulting in a successful login.
Impact and Specific Risks for Alpine Linux and Cloud Images
The impact of the OpenSSH flaw is particularly pronounced for Alpine Linux and cloud images, where default configurations may expose systems to unauthorized access. According to research, Alpine Linux's official AWS and Azure cloud images include an affected 'alpine' account with passwordless 'doas' privileges, which could allow attackers to gain root access. This vulnerability becomes exploitable as soon as any $6$ hash exists on the machine, such as when an admin sets a console password or user-data adds a user with a hashed password. Additionally, accounts with no password set—such as key-only users, root, and the 'alpine' user in the official cloud images—can become open to attack under these conditions. These risks are specific to Alpine Linux and do not apply universally to all Linux distributions or environments. The flaw is limited to systems where the OpenSSH server is installed, such as on OpenWrt.
Mitigation and Fixes Available
Mitigation and fixes are available for the OpenSSH flaw that allows attackers to log into password-disabled Linux accounts. The vulnerability has been addressed in OpenSSH 10.6p2, and Alpine Linux administrators are advised to update their OpenSSH packages using apk upgrade openssh (BleepingComputer). Fixed package versions are available across multiple branches, including edge, 3.24, 3.23, and others, as detailed in the advisory (alpinelinux.org). For users building OpenSSH manually, version 10.6p2 includes the necessary change, as noted in its release notes (thehackernews.com). Administrators should also check /var/log/messages for lines indicating Accepted password for an account with no password, such as alpine, root, or a key-only user (thehackernews.com). OpenSSH describes the fix as a workaround, noting that the root cause lies outside sshd (thehackernews.com).
Detection and Monitoring for Exploitation
Detection and monitoring for exploitation of the OpenSSH flaw involves examining SSH authentication logs for signs of unauthorized password-based logins. Administrators can use commands like grep "Accepted password" /var/log/messages on Alpine Linux to identify successful password logins for accounts that should not allow them, such as alpine, root, or key-only users. If logs show a successful password login for an account that has password authentication disabled—indicated by a * in the password field of /etc/shadow—it may suggest the vulnerability was exploited. The advisory recommends checking for sshd lines in /var/log/messages that read Accepted password for accounts with no password. The system hashes password attempts using crypt(), a C library function, and compares the result with the stored field. The maximum password length allowed by sshd is 1,024 bytes.
Sources and reporting notes
Based on published source material. No independent hands-on testing is claimed.