LiveBreach Intelligence: data breaches, leaks & ransomware, tracked as they surfaceOngoing protection: GalaxyWarden →
Recent BreachesData breach tracker

CVE-2021-3156: Sudo Heap-Based Buffer Overflow Vulnerability

RBRecent Breaches Vulnerability Intelligence·Apr 6, 2022
High⚠ Actively exploited (CISA KEV)
High
Severity
Active
CISA KEV
No
Ransomware use
Apr 27, 2022
Patch deadline
⚠ Exploited in the wild. CISA added CVE-2021-3156 to its Known Exploited Vulnerabilities catalog on Apr 6, 2022, with a federal patch deadline of Apr 27, 2022 — meaning attackers are actively using it. If you run the affected software, patch it immediately.

Sudo contains an off-by-one error that can result in a heap-based buffer overflow, which allows for privilege escalation.

CVE-2021-3156 is a heap-based buffer overflow in Sudo, the common Unix and Linux utility that lets authorized users run commands with elevated privileges. An off-by-one error can be abused for local privilege escalation, letting a lower-privileged user potentially gain root-level control on the host. Because Sudo is installed by default on most enterprise Linux and Unix systems, unpatched instances create a straightforward path from a foothold to full system compromise.

Defenders should treat this as a high-priority local escalation issue. Confirm exact affected releases, fixed packages, and any configuration caveats directly against the vendor advisory before acting.

How it works

The vulnerability belongs to the heap-based buffer overflow class (CWE-122) and stems from an off-by-one error (CWE-193). In essence, Sudo mishandles certain input length calculations when processing command-line arguments or related data structures. The resulting one-byte discrepancy can overflow a heap buffer.

An attacker who already has a local unprivileged shell can craft input that triggers the overflow. Successful exploitation corrupts heap metadata or adjacent data in a way that allows arbitrary code execution or control-flow hijacking inside the Sudo process, which normally runs with elevated privileges. The end result is privilege escalation to root. No remote vector is implied by the public description; the attack requires local access. Exact trigger conditions and any required Sudo features must be verified in the vendor advisory rather than assumed.

Am I affected? How to find it in your systems

Sudo is present on virtually every Linux distribution, BSD variant, and many commercial Unix systems used as servers, workstations, containers, and network appliances. It is typically invoked via the sudoers policy and is often relied upon by automation, administrators, and service accounts.

Inventory steps:

Telemetry and log signs of exploitation attempts are limited because the overflow occurs inside a privileged local process. Look for unexpected sudo crashes, core dumps, or sudden privilege changes by non-administrative accounts. Enable process-creation and command-line auditing where available so that anomalous sudo invocations can be reviewed later. Absence of clear indicators does not prove safety; version inventory remains the primary detection method.

How to remediate

Patching is the primary and expected remediation. Apply the vendor-supplied update for Sudo exactly as directed in the official advisory and in your distribution’s security notices. CISA’s required action is simply to apply updates per vendor instructions.

Once patched, review sudoers policy for least-privilege opportunities: remove broad NOPASSWD rules, limit command arguments, and ensure that only necessary users retain sudo rights. These hardening steps reduce the value of any future local escalation bugs.

If you can't patch immediately

When immediate patching is blocked by change windows or compatibility concerns, apply compensating controls to shrink the attack surface until the update can be installed.

Monitor closely for any signs of local exploitation and schedule the official patch as soon as practicable. Compensating controls buy time; they do not eliminate the underlying memory-safety flaw.

If your data may have been exposed

Actively exploited local privilege-escalation vulnerabilities frequently serve as the bridge from an initial foothold to full host takeover and subsequent data theft or ransomware deployment. Although ransomware use specifically tied to this CVE is not documented, any successful escalation can lead to credential dumping, lateral movement, and exfiltration. If you have reason to believe hosts were compromised before patching, perform standard incident-response steps: isolate affected systems, preserve volatile evidence, rotate credentials, and examine authentication and process logs for unauthorized root activity. As a quick additional check, you can run a free exposure scan of your email addresses against known breach data sets to see whether associated credentials have already appeared in public leaks.

AICompiled with AI assistance from public sources and published under our editorial standards.

Details

AffectedSudo · Sudo
WeaknessCWE-122
Added to CISA KEVApr 6, 2022
Federal patch deadlineApr 27, 2022
Known ransomware useNot documented
Check if your data is exposed →

Official records: NVD · CISA KEV

← All actively-exploited vulnerabilities