UK — The Register
Get root on a musl Linux system by slamming it with an overly long password
Security1 min read
A security flaw in OpenSSH on some Linux systems that use musl libc could let an attacker get root access. The attacker does this by typing a password that is longer than 256 bytes.
A long password can open the door
Researcher Özgün Kültekin found a bug nicknamed *sshole. On certain Linux systems, an attacker could log in as root by sending a password between 257 and 1,024 characters. The bug is now fixed, so users should install the patch.
Key facts
- The bug only works on certain Linux systems that use musl libc instead of the usual GNU C library.
- The system must run OpenSSH's SSH daemon without PAM and with password login turned on.
- At least one other account must have a valid password hash.
- The bug has been in OpenSSH since 2016.
Where the bug comes from
The roots of the bug go back to early BSD Unix in 1980. An asterisk (*) in the password file meant that an account could not log in with a password. Today, the asterisk is still used for accounts that should not accept passwords. But it is not a fully safe way to block logins. Musl libc returns an asterisk when password hashing fails, and it caps passwords at 256 bytes. OpenSSH's 2016 fix for hiding which account names exist also made the problem reachable.
Why it matters
Musl libc is common in small embedded devices. It is also the standard C library for Alpine Linux, which has official cloud images for AWS and Azure. Some Alpine systems in those clouds may be at risk, depending on how they are set up.
What to watch
- Install the OpenSSH update on any system that could be affected.
- Check whether your servers use musl libc, especially Alpine Linux in the cloud.
- Check whether your SSH setup matches the conditions described above.
Glossary
- OpenSSH
- A free tool that lets people log in to computers securely over a network.
- musl libc
- A small library of basic code that Linux programs use. It is smaller than the usual GNU C library.
- PAM
- Pluggable Authentication Modules, a system that checks who you are when you log in.
- Alpine Linux
- A small Linux system often used in cloud servers and containers.
- root
- The all-powerful admin account on a Linux system.
- password hash
- A scrambled version of a password that is stored instead of the real password.