home / blog

2026-10-31 · high

CVE-2021-3156: Sudo Buffer Overflow - Privilege Escalation

Buffer overflow in Sudo enables root privilege escalation via sudoedit - CVSS 7.8 (high)

CVE-2021-3156: Sudo Buffer Overflow - Privilege Escalation

CVE-2021-3156 is an off-by-one error vulnerability in Sudo's sudoedit command that results in a heap-based buffer overflow. The flaw allows a local user to escalate privileges to root using the -s flag combined with a command-line argument ending in a single backslash character. It affects all Sudo installations before version 1.9.5p2 and is rated as high priority with CVSS 7.8.

The severity is documented by a CVSS score of 7.8 in the High category. The vulnerability was published on NVD on January 26, 2021, making it known for over five years. However, recent signals from the community (October 31, 2026) indicate the presence of public repositories claiming to contain exploit code, suggesting renewed interest in this flaw among researchers and potentially in attack circles. The criticality remains high given Sudo's widespread presence in Unix/Linux systems.

IT administrators and CISOs must prioritize immediate update of Sudo to version 1.9.5p2 or later on all production Unix and Linux systems. Verify current version and compare against secure baseline. For systems that cannot be patched immediately, implement strict access controls and continuously monitor sudoedit logs for suspicious exploitation attempts. The criticality and ease of exploitation make this patch non-deferrable.

At a glance

What
Off-by-one error in Sudo causing heap-based buffer overflow in sudoedit. Enables root privilege escalation via sudoedit -s with command-line argument ending in single backslash.
Severity
CVSS 7.8 (High). Direct user-to-root escalation.
Affected versions
Sudo versions before 1.9.5p2
Fix
Update to Sudo 1.9.5p2 or later
Status
Published on NVD January 26, 2021. Recent signals of public repositories (October 31, 2026)
Action
Verify installed Sudo version; apply critical patch; monitor systems if not patchable

Sources: NVD, CVE-2021-3156

← All articles