Oh ****... Sudo has a 'make anyone root' bug that needs to be patched – if you're unlucky enough to enable pwfeedback
Most distros unaffected unless defaults were changed, but do check
Sudo, a standard tool on Unix-y operating systems that lets select users run some or all commands as root, can be exploited to give superpowers to any logged-in user – if deployed with a non-default configuration.
This security hole, discovered by Joe Vennix at Apple Information Security, is only active if the pwfeedback option is enabled. This option shows an asterisk each time a key is pressed, when entering a password. The good news is that pwfeedback is generally disabled by default.
Sudo is included in macOS, but this option was not enabled when we tried it on our Catalina box. However, a few Linux distributions – seemingly Mint and Elementary OS – do enable the option. The purpose of the feature, as its name implies, is to reassure users that they are not typing into a black hole.
If sudo is installed and vulnerable, any user can trigger the vulnerability, even if not listed in the sudoers list of those with sudo privileges.
Like many programming blunders, this is a buffer overflow issue. "The code that erases the line of asterisks does not properly reset the buffer position if there is a write error, but it does reset the remaining buffer length. As a result, the
getln() function can write past the end of the buffer," the sudo developers explain. There is also a flaw that means the pwfeedback option is not ignored, even when reading from something other than a terminal device.
You can tell if you are vulnerable by running
sudo -l and checking the output. If the word pwfeedback appears under Matching Defaults entries, it is potentially at risk. The next thing to do is to check the version number with
sudo --version. Versions 1.7.1 to 1.8.25p1 inclusive are vulnerable. The bug is fixed in sudo 1.8.31, available now, and versions 1.8.26 to 1.8.30 are not exploitable.
Our brand-new install of Linux Mint was indeed affected, with pwfeedback enabled.
The solution is to disable pwfeedback in the sudoers file, as explained in the linked article, or update to a fixed version. ®