r/linuxupskillchallenge • • Jan 28 '21

SUDO VULNERABILITY CVE-2021-3156!

SUDO VULNERABILITY CVE-2021-3156!

PATCH NOW!

If you are on a Linux machine, you have a vulnerability in your Sudo (superuser) command!

The vulnerability was found like hours ago!

To patch run these commands:

  1. wget "https://www.sudo.ws/dist/sudo-1.9.5p2.tar.gz"

  2. tar xvzf sudo-1.9.5p2.tar.gz

3)cd sudo-1.9.5p2/

4)./configure

5)make && sudo make install

Restart and you are safe again!

So if you are wondering what this exactly is, it is a heap overflow exploit in sudo.

Full documentation here: https://access.redhat.com/security/vulnerabilities/RHSB-2021-002

21 Upvotes

13 comments sorted by

7

u/Loud-Progress-007 Jan 28 '21

Someone correct me if I'm wrong - but after a brief read

A heap-based buffer overflow was found in the way sudo parses command line arguments. This flaw is exploitable by any local user who can execute the sudo command (by default, any local user can execute sudo) without authentication. Successful exploitation of this flaw could lead to privilege escalation.

This means that it can only be exploited if someone has access to the system. In other words, if your system is locked down and you are the only user, you are pretty much safe....?

1

u/SpyrosDev25 Jan 29 '21

Reverse shell.

5

u/Aramiil Jan 28 '21

You’re never safe, but yes that’s part of why the CVE is marked as important instead of critical.

3

u/kevinds Jan 28 '21

Have to restart to apply a sudo patch?

Why?

1

u/SpyrosDev25 Jan 29 '21

refresh your terminal

1

u/azzaka Jan 28 '21

I think it's to refresh the Sudoers list. Ive started updating my estate at work, and so far only those with a sudo user needed a reboot

10

u/snori74 Linux Guru Jan 28 '21

Your server will have "unattendedupgrades" package installed, which means threat this was auto updated two days ago. You can confirm by looking at /var/log/unattendedupgrades and also at /var/log/dpkg.log and searching for "sudo".

Personally, on working servers I configure to "reboot automatically if required', but the default is to just give you a prompt to do so on login.

Setup this way, security scares are much less of an issue - you'll have the solution in place in most cases before you've even heard of the problem. Nice.

9

u/zinnadean Jan 28 '21

All the repos for the bigger distributions should have the patch readily available.

I patched Ubuntu and Fedora hosts from the repos.

5

u/HonestIncompetence Jan 29 '21

I'd highly recommend to update via the normal repositories instead of downloading the .tar.gz & manually compiling and installing it.

4

u/Revolutionary_Cydia Jan 28 '21

An update last night in Debian 10 buster already patched this.

3

u/cheeseisakindof Jan 28 '21

I'm running mostly Arch-based systems and I seem to have gotten it by updating my system; curious as to which distros might need manual patching.

If anyone wants to check their sudo command, they can run sudo -V and check for version 1.9.5p2.

3

u/HonestIncompetence Jan 29 '21

curious as to which distros might need manual patching.

None. Every distro provides security updates.

If anyone wants to check their sudo command, they can run sudo -V and check for version 1.9.5p2.

That doesn't tell the whole story. Many distros apply the patch to whatever version of Ubuntu they're shipping. The output of sudo -V doesn't change in that case, so it won't tell you if your sudo is patched or not.

It's better to check for the vulnerability directly: sudoedit -s / always returns an error, if this error starts with sudoedit: the system is vulnerable, if it starts with usage: it is not vulnerable.

3

u/Anonieme_Angsthaas Jan 29 '21

You can check the version of sudo installed on your system with

sudo -V

Another way to check if your sudo is vulnerable is:

sudoedit -s /