Critical Vulnerability Patched in 'sudo' Utility for Unix-Like OSesCritical Vulnerability Patched in 'sudo' Utility for Unix-Like OSes
Flaw exists in versions of sudo going back nearly 10 years; USCYBERCOM recommends organizations patch immediately.
January 27, 2021
The maintainer of sudo, a utility in nearly all Unix and Linux-based operating systems, this week patched a critical buffer overflow vulnerability in the program that gives unauthenticated local users a way to gain root privileges on a host system.
Qualys security researchers who discovered the nearly 10-year-old bug (CVE-2021-3156) say it was first introduced in July 2011 and impacts all versions of sudo from 1.8.2 to 1.8.31p2 and 1.9.0 through 1.9.5p1.
The researchers were able to independently verify the vulnerability and exploit it in multiple ways to gain root privileges on Debian 10 with sudo 1.8.27; Ubuntu 20.04 and sudo 1.8.31; and Fedora 33 with sudo 1.9.2, according to Qualys. Other operating systems and distributions are likely vulnerable to the same issue.
No mitigations are available for the threat. Qualys recommends that all organizations using Unix and Linux distributions with sudo-enabled in them immediately implement vendor supplied patches or upgrade to sudo 1.9.5p2, the latest version of the utility. It was released this week.
"Patching is the only option," says Mehul Revankar, vice president of product management and engineering at Qualys.
The seriousness of the bug prompted a tweet from US Cyber Command (USCYBERCOM) Wednesday, urging organizations to patch as soon as possible. "This is a far more dangerous #Sudo vulnerability than seen in the recent past," it tweeted.
To test whether a system is vulnerable, an admin should log into the system as a non-root user and run the "sudoedit -s /" command.
"If the system is vulnerable, it will respond with an error that starts with 'sudoedit:'," Revankar says. "If the system is patched, it will respond with an error that starts with 'usage:'."
Sudo is a utility that administrators can use to delegate root-level admin authority to specific users or groups of users while copiously logging all their commands and activities. Administrators can use the utility to enable or restrict what commands a user can execute on a host system and to centrally manage user privileges on a per-host basis.
Software engineer Todd Miller, who currently maintains sudo, on Tuesday said the heap-based buffer overflow bug exists in code that executes when sudo runs a command in shell mode via the use of -s and –I options. (Read here for details.) By itself, the bug is harmless. However, the presence of another bug in sudo's command-line parsing code makes the discovery of the new issue dangerous, he notes.
"I'd speculate that it remained undiscovered for so long because it is a combination of two bugs," Revankar says. "Thus, people might have found one bug but disregarded it as useless because they did not find the other."
An attacker would need local access to a vulnerable system in order to exploit the vulnerability. In many instances, this would mitigate the seriousness of the flaw because an adversary that already has access to a system can do a lot of damage with that access.
What makes this flaw dangerous is that an unauthenticated attacker can use it to escalate privileges even if not listed in the "sudoers" file, which allocates admin rights to specific individuals.
"The user does not need to be a privileged user, a local user, or be a part of sudoers list," Revankar says. "For example, even account 'nobody' can exploit the issue. That's why this is so critical."
A local vulnerability usually doesn't require panic since an attacker needs another vulnerability to gain access to the system first, adds Kelly Shortridge, vice president of product strategy at Capsule8.
"In this case, aside from the vulnerability being present for roughly a decade, sudo is a utility that is available by default in most Linux distributions – which makes for a huge potential footprint."
All that is required for an attacker to exploit the vulnerability is shell mode and the presence of a sudoers policy in an organization's Linux infrastructure, she says.
Shortridge says enterprises with a containerized production environment are somewhat protected against the bug.
"If an attacker successfully exploits this vulnerability, they will gain root access in the container but not in the underlying host itself," she notes.
About the Author(s)
Hacking Your Digital Identity: How Cybercriminals Can and Will Get Around Your Authentication MethodsOct 26, 2023
Modern Supply Chain Security: Integrated, Interconnected, and Context-DrivenNov 06, 2023
How to Combat the Latest Cloud Security ThreatsNov 06, 2023
Reducing Cyber Risk in Enterprise Email Systems: It's Not Just Spam and PhishingNov 01, 2023
SecOps & DevSecOps in the CloudNov 06, 2023