Attacker Value
Very High
(4 users assessed)
Exploitability
Very High
(4 users assessed)
User Interaction
None
Privileges Required
Low
Attack Vector
Local
12

CVE-2021-3156 "Baron Samedit"

Disclosure Date: January 26, 2021
Exploited in the Wild
Add MITRE ATT&CK tactics and techniques that apply to this CVE.
Execution
Techniques
Validation
Validated
Initial Access
Techniques
Validation
Validated
Privilege Escalation
Techniques
Validation
Validated

Description

Sudo before 1.9.5p2 contains an off-by-one error that can result in a heap-based buffer overflow, which allows privilege escalation to root via “sudoedit -s” and a command-line argument that ends with a single backslash character.

Add Assessment

7
Ratings
Technical Analysis

Sudo is vulnerable to a local privilege escalation that enables any local user to gain root privileges. This is due to a heap-based buffer overflow when unescaping backslashes in the command’s arguments. This vulnerable code has been introduced in July 2011. According to the advisory, legacy versions from 1.8.2 to 1.8.31p2 and stable versions from 1.9.0 to 1.9.5p1 are vulnerable in their default configurations. Note that the local user password is not required to successfully exploit this vulnerability.

The exploitation is done by invoking “sudoedit -s” command to reach the vulnerable code and do an out-of-bounds write in heap memory. The security researchers were able to exploit this vulnerability and get a shell as root using 3 different methods. One of them, which seems to be the easiest and the most reliable, is demo’ed in this video.

I couldn’t find any PoC available, but there are enough technical details in the advisory to write an exploit. It is a critical bug and sudo should be patched immediately. It is very likely a working exploit will be publicly available soon.

3
Ratings
  • Attacker Value
    Very High
  • Exploitability
    Very High
1
Ratings
  • Attacker Value
    Low
  • Exploitability
    Low
CVSS V3 Severity and Metrics
Base Score:
7.8 High
Impact Score:
5.9
Exploitability Score:
1.8
Vector:
CVSS:3.1/AV:L/AC:L/PR:L/UI:N/S:U/C:H/I:H/A:H
Attack Vector (AV):
Local
Attack Complexity (AC):
Low
Privileges Required (PR):
Low
User Interaction (UI):
None
Scope (S):
Unchanged
Confidentiality (C):
High
Integrity (I):
High
Availability (A):
High

General Information

Vendors

  • beyondtrust,
  • debian,
  • fedoraproject,
  • mcafee,
  • netapp,
  • oracle,
  • sudo project,
  • synology

Products

  • communications performance intelligence center,
  • debian linux 10.0,
  • debian linux 9.0,
  • diskstation manager 6.2,
  • diskstation manager unified controller 3.0,
  • fedora 32,
  • fedora 33,
  • hci management node -,
  • micros compact workstation 3 firmware 310,
  • micros es400 firmware,
  • micros kitchen display system firmware 210,
  • micros workstation 5a firmware 5a,
  • micros workstation 6 firmware,
  • oncommand unified manager core package -,
  • privilege management for mac,
  • privilege management for unix/linux,
  • skynas firmware -,
  • solidfire -,
  • sudo,
  • sudo 1.9.5,
  • tekelec platform distribution,
  • vs960hd firmware -,
  • web gateway 10.0.4,
  • web gateway 8.2.17,
  • web gateway 9.2.8

Exploited in the Wild

Reported by:

References

Advisory

Additional Info

Technical Analysis

Description

On Tuesday, January 26, 2021, the Qualys Research Team published a blog post on CVE-2021-3156, a privilege escalation vulnerability in the sudo command that enables any local user to gain root privileges without using a password, even if the user is not listed in the sudoers file. The vulnerability arises from a heap-based buffer overflow when unescaping backslashes in a supplied command’s arguments. The vulnerable code was introduced in July 2011 and affects most Linux-based operating systems. See the project maintainers’ advisory on the vulnerability for further details.

Affected Products

According to the advisory, legacy versions of sudo from 1.8.2 to 1.8.31p2 and stable versions from 1.9.0 to 1.9.5p1 are vulnerable in their default configurations. Depending on the Linux distribution, the version number might be different. Please check the Guidance section for details.

Rapid7 analysis

CVE-2021-3156 is a local privilege escalation vulnerability, which means an attacker requires existing access to a target (such as through remote code execution) in order to exploit the bug. Exploitation is achieved by invoking the sudoedit -s command to reach the vulnerable code and perform an out-of-bounds (OOB) write in heap memory. Upon successful exploitation, the attacker would gain root access, resulting in full compromise of the system.

At the time of this writing, a crash PoC is available from Qualys. Rapid7 researchers have reliably reproduced the crash using the supplied PoC. The advisory contains enough technical detail to develop the PoC into an exploit. Researchers will have to bypass any memory protections in place, though the bug allows for a great amount of control over the OOB write, reducing the burden of exploitation. It is only a matter of time before exploits begin to surface.

Guidance

Rapid7 recommends that sudo users update to version 1.9.5p2 immediately. The legacy release stream 1.8.x has not yet received a critical bug fix for CVE-2021-3156. There is no effective mitigation for this vulnerability. Patched versions are listed below.

Official maintainer:

Linux distributions:

References