Affiliate Disclosure
If you buy through our links, we may get a commission. Read our ethics policy.

macOS Sudo vulnerability could give root privileges to any local user

Sudo exploit in Unix could lead to root access

Last updated

A decade-old flaw found in the Sudo tool could lead to root access on Unix-based systems, including macOS Big Sur and earlier versions.

In January, security researchers disclosed a new vulnerability that can affect Unix-based operating systems. The exploit is identified as CVE-2021-3156, heap-based buffer overflow in Sudo. The exploit appears similar to a previously patched flaw called CVE-2019-18634.

The researchers at Qualys identified the exploit in Ubuntu 20.04 (Sudo 1.8.31), Debian 10 (Sudo 1.8.27), and Fedora 33 (Sudo 1.9.2). They say it can affect other operating systems and distributions running the affected version of Sudo. All legacy versions from 1.8.2 to 1.8.31p2 and all stable versions from 1.9.0 to 1.9.5p1 are affected.

The researchers note that users will need access to the computer to run the exploit. The exploit has existed for at least 10 years, however this is the first known documentation of it.

At first, it was not clear whether the vulnerability exists in macOS, but security researcher Matthew Hickey disclosed on Wednesday that the bug can also be exploited on Macs.

"To trigger it, you just have to overwrite argv[0] or create a symlink, which therefore exposes the OS to the same local root vulnerability that has plagued Linux users the last week or so," Matthew Hickey, co-founder of Hacker House told ZDNet.

Hickey's findings were confirmed by other prominent macOS security researchers. Patrick Wardle confirmed the findings to ZDNet, and vulnerability analyst Will Dormann verified the research in a tweet.

Now that the exploit has been made known to Linux distributors it will likely be patched soon. Apple could release a security update with the patch at any time, but users can act sooner if they feel it is necessary.

Qualys offers a paid program that explains how to patch the exploit, however most users will not need to concern themselves.

Who's at risk, and how to protect yourself

The vulnerability exists in both older and recent macOS versions, so it appears that a significant number of Macs can be exploited. However, since the vulnerability requires local access to the computer and the exact exploitation has not been made public, it is unlikely any regular user will be affected prior to a macOS update.

Hickey said he notified Apple of the security flaw earlier on Wednesday. Apple has declined to comment while it investigates the issue.



28 Comments

auxio 19 Years · 2766 comments

Given how long these tools have been around (40+ years in some cases), how relatively simple the code is compared to modern software, and the fact that they're used in server environments, I'm very surprised they haven't been fully security audited by now.

glennh 9 Years · 74 comments

Is not this like saying someone can burglarized your house once they are physically inside your house? /s

zimmie 9 Years · 651 comments

auxio said:
Given how long these tools have been around (40+ years in some cases), how relatively simple the code is compared to modern software, and the fact that they're used in server environments, I'm very surprised they haven't been fully security audited by now.

sudo is not at all simple, and it has reached the level of complexity where it's basically impossible to confidently reason about it. The OpenBSD team made something simpler (doas) a while ago. Maybe this is the kick people need to finally adopt it more broadly.

DAalseth 6 Years · 3067 comments

I’m very surprised that Macs would be impacted. OS-X/macOS forked off from BSD a very long time ago. This exploit must really go back into the dark ages.

JustSomeGuy1 6 Years · 330 comments

glennh said:
Is not this like saying someone can burglarized your house once they are physically inside your house? /s
Not at all. It's a bit like saying someone can burglarize your house with ease if they manage to get into your gated community. It's definitely a Bad Thing. For example, it means that if you download and run malware, the malware wouldn't have to go through an authentication dialog to get administrative access.

DAalseth said:
I’m very surprised that Macs would be impacted. OS-X/macOS forked off from BSD a very long time ago. This exploit must really go back into the dark ages.
No, about 10 years.

Just because OS X forked off FreeBSD (and NetBSD, which for some reason most people don't realize was a big part of the code base too) a long time ago doesn't mean it doesn't inherit bugs that are much much newer. It keeps up-to-date (or at least not more than a year or three old, sigh) versions of almost all the open-source code it uses, which is a huge part of the OS. And that's good! Older-version bugs are usually more dangerous than newer-version ones.

It may be that Apple hasn't patched it already because some genius there said to himself "hey, we don't even ship sudoedit, so we're not vulnerable!" That of course misses the point that an unprivileged attacker can just create a sudoedit link to sudo. I expect they'll get this fixed soon. It's egregious and easily corrected.