Fixxx
Moderator
- Joined
- Aug 21, 2024
- Messages
- 1,133
- Reaction score
- 5,726
- Points
- 113
A newly disclosed flaw involving OpenSSH and musl, dubbed "*sshole," allows attackers to log in to certain Alpine Linux and other musl-based Linux accounts configured to block password authentication simply by entering an oversized password. The flaw only affects OpenSSH servers running on Linux distributions that use the musl C library, including Alpine Linux, OpenWrt, Buildroot, and Yocto, under certain authentication configurations. Security researcher Ozgun Kultekin, who discovered and released details on the vulnerability today, says the flaw has existed since 2016 and stems from how OpenSSH handles password verification errors on systems using the musl C library. Linux accounts can be configured to prevent password logins by replacing their password hash with an asterisk (*) in the /etc/shadow file. Because this is not a valid password hash, no password should allow access to those accounts. However, a patch introduced in OpenSSH in 2016 to fix a username enumeration vulnerability tracked as CVE-2016-6210 changed how OpenSSH handled accounts without usable password hashes. To prevent attackers from identifying valid usernames through different response times, OpenSSH was modified to perform password hashing even when an account had no usable password hash, including accounts configured with * to block password logins. The problem is that the musl C library's crypt() function also returns * when password hashing fails, including when a submitted password exceeds its 256-byte limit. This means an attacker can submit an oversized password and cause OpenSSH to compare the returned * against the account's stored *, resulting in a successful login. To be clear, the flaw does not allow attackers to bypass passwords on accounts with valid password hashes. Kultekin says exploitation requires the following conditions:
- OpenSSH is running on a musl-based Linux system, such as Alpine Linux, OpenWrt, Buildroot, or Yocto.
- PAM authentication is disabled, as it is by default in Alpine Linux's openssh-server package.
- SSH password authentication is enabled.
- At least one account has an asterisk (*) as its password hash.
- Another account has a valid password hash.
grep "Accepted password" /var/log/messages
If the logs show a successful password login for the alpine account, administrators can check whether that account has password authentication disabled:
grep '^alpine:' /etc/shadow
If the account's password field contains *, but SSH logs show a successful password login, it could indicate that the vulnerability was exploited.