Skip to content

OSG-SEC-2021-01-27 heap-based buffer overflow in sudo


CentOS8 packages now available [6].


In the previous notice the patched versions were erroneously listed as the impacted versions. The heading has been updated in the message below for clarity.

Dear OSG Security Contacts,

A heap-based buffer overflow vulnerability that could lead to privilege escalation described in CVE-2021-3156 [1] has been discovered in 'sudo' [2]. The vulnerable code was introduced in July 2011 and affects all legacy versions of sudo from v1.8.2 to v1.8.31p2, and all stable versions from v1.9.0 to v1.9.5p1, using default configurations. The OSG Security team considers this vulnerability to be of CRITICAL severity.

Patched Versions:

RHEL/CentOS7: sudo-1.8.23-10.el7_9.1 [3][4]

RHEL/CentOS8: sudo-1.8.29-6.el8_3.1 [5]

Other operating systems and distributions are also likely to be exploitable.


The vulnerability is exploitable by any local user. The attacker does not need to know the user's password, nor be a part of any sudoers list. Successful exploitation of this vulnerability could lead to privilege escalation.


How to Check: As a non-root user account, run the following: sudoedit -s '\' `perl -e 'print "A" x 65536'`

A vulnerable system will segfault or show a similar error indicating memory corruption.

If your system has local user accounts, update to the latest version of 'sudo' available for your operating system. After updating, run the command in "How to Check" above to verify the patch. If a patch is not yet available for your system, a mitigation using 'systemtap' has been described in the RedHat announcement for this issue [2]. The OSG Security team recommends updating as soon as possible.;O=D






[5] (RHEL8)


Please contact the OSG security team immediately at security at if you have any questions or concerns.

OSG Security Team