GitHub security researcher Kevin Backhouse found bugs in Ubuntu 20.04 (a long-term support release) which enabled any desktop user to get root access. The vulnerabilities have now been patched.
Backhouse discovered two separate issues, one by accident, which together enable the privilege escalation. He noted that the vulnerability is a basic one. “It's unusual for a vulnerability on a modern operating system to be this easy to exploit. I have, on some occasions, written thousands of lines of code to exploit a vulnerability,” he said.
The first part is an attack which exploits AccountsService, a daemon which manages user accounts. This comes from the freedesktop project but is modified by Ubuntu’s developers to read a file in the user’s home directory.
Pointing this file to /dev/zero (a special location which returns an infinite string of null characters) via a symbolic link makes the service hang. When reading the file, AccountsService drops to user privileges as a security precaution, with the unfortunate side-effect that the user can kill the process.
This enables the second part of the attack, which uses a component of the Gnome desktop that triggers system setup when there are no user accounts. If the AccountsService is unresponsive, the component thinks it is setup time and launches dialogs that enable the creation of a new user with root privileges.
Backhouse discovered the AccountsService issue while looking for security vulnerabilities, but the ability to create a new account was found by accident, after triggering the first problem.
The vulnerability only impacts desktop users, and requires access to the GUI, so it is not easy to exploit in most scenarios. That said, Ubuntu Server could in principle be vulnerable if the desktop is installed and a user has some level of access. According to the Ubuntu notes, all releases from 16.04 LTS to the recent 20.10 are affected.
Although Backhouse said that this exploit is particularly easy to execute, he added that he does not want “to give you impression that Ubuntu is full of trivial security bugs; that’s not been my impression so far.”
Linux is most popular though as a server operating system so it is possible that the desktop components have been subject to less scrutiny.
All in all, more good reasons to keep systems patched and not to install a GUI on a server. ®