← Vulnerability feed

Vulnerability record · CVE-2021-3156 · published 26 January 2021

CVE-2021-3156: Sudo off-by-one heap overflow allows root privilege escalation

Sudo Project · Sudo

Sudo before 1.9.5p2 contains an off-by-one error leading to a heap-based buffer overflow. Triggering it via 'sudoedit -s' with a command-line argument ending in a single backslash lets a local user escalate to root. Because sudo is present on most Linux and Unix systems, the flaw has broad reach across enterprise fleets.

7.8 CVSS 3.1 High CISA KEV since 6 Apr 2022 EPSS 100% · top 0.1% CWE-193 · CWE-193
7.8CVSS 3.1 base score, v2 7.2
100%EPSS exploitation probability, 30 days
YesIn CISA KEV, fix deadline passed
24Affected product versions listed by NVD
68References, 23 tagged exploit
17 Jun 2026Last modified by NVD

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.

CVSS:3.1/AV:L/AC:L/PR:L/UI:N/S:U/C:H/I:H/A:H

Automated analysis

Generated by VULONE's analysis model from the NVD record, CISA KEV and EPSS data on 16 September 2026. Confidence: high.

critical priorityLocal root privilege escalation on a ubiquitous utility with public exploits, KEV listing and near-maximum EPSS probability.

What it is

Sudo before 1.9.5p2 contains an off-by-one error leading to a heap-based buffer overflow. Triggering it via 'sudoedit -s' with a command-line argument ending in a single backslash lets a local user escalate to root. Because sudo is present on most Linux and Unix systems, the flaw has broad reach across enterprise fleets.

Impact

An attacker with a local account gains root privileges, achieving full control of the host including credential access, persistence and lateral movement.

Attack surface

Reached locally by executing sudo or sudoedit with a crafted argument; the CVSS vector shows local access, low privileges and no user interaction, and no authentication beyond an existing local session is required.

Exploitation

CISA added it to KEV on 2022-04-06 with a 2022-04-27 remediation due date, EPSS 30-day probability is 0.99969 (99.977th percentile), and multiple references are tagged Exploit, indicating public exploit code exists.

What to do

  • Upgrade sudo to 1.9.5p2 or later, or apply the vendor backport for your distribution.
  • Patch all affected products listed by vendors including NetApp, Synology, Oracle, McAfee and BeyondTrust appliances.
  • Restrict local shell access and review who holds unprivileged accounts on sudo-enabled hosts.
  • Verify the sudo version on every Linux and Unix host, including appliances and embedded systems.
  • Monitor vendor advisories for updated builds where the bundled sudo cannot be replaced directly.

Detection

  • Alert on sudo or sudoedit process executions whose arguments end with a single backslash.
  • Audit sudo version strings across the fleet and flag anything below 1.9.5p2.
  • Monitor for unexpected root-level process creation or privilege changes originating from non-root users.
  • Review sudo and authentication logs for anomalous sudoedit invocations or crashes.

This assessment is produced automatically and is not human-reviewed. Verify against the vendor advisory before acting on it.

Exploitation in the wild

CISA added CVE-2021-3156 to the Known Exploited Vulnerabilities catalog on 6 April 2022 as "Sudo Heap-Based Buffer Overflow Vulnerability". Required action: Apply updates per vendor instructions. Federal deadline 27 April 2022.

Affected products

24 vulnerable configurations from NVD's CPE data, grouped by vendor and product.

References

LinkTags
http://packetstormsecurity.com/files/161160/Sudo-Heap-Based-Buffer-Overflow.html ExploitThird Party AdvisoryVDB Entry
http://packetstormsecurity.com/files/161230/Sudo-Buffer-Overflow-Privilege-Escalation.html ExploitThird Party AdvisoryVDB Entry
http://packetstormsecurity.com/files/161270/Sudo-1.9.5p1-Buffer-Overflow-Privilege-Escalation.html ExploitThird Party AdvisoryVDB Entry
http://packetstormsecurity.com/files/161293/Sudo-1.8.31p2-1.9.5p1-Buffer-Overflow.html ExploitThird Party AdvisoryVDB Entry
http://packetstormsecurity.com/files/176932/glibc-syslog-Heap-Based-Buffer-Overflow.html ExploitThird Party AdvisoryVDB Entry
http://seclists.org/fulldisclosure/2021/Feb/42 Mailing ListThird Party Advisory
http://seclists.org/fulldisclosure/2021/Jan/79 ExploitMailing ListThird Party Advisory
http://seclists.org/fulldisclosure/2024/Feb/3 ExploitMailing ListThird Party Advisory
http://www.openwall.com/lists/oss-security/2021/01/26/3 ExploitMailing ListThird Party Advisory
http://www.openwall.com/lists/oss-security/2021/01/27/1 Mailing ListThird Party Advisory
http://www.openwall.com/lists/oss-security/2021/01/27/2 Mailing ListThird Party Advisory
http://www.openwall.com/lists/oss-security/2021/02/15/1 ExploitMailing ListThird Party Advisory
http://www.openwall.com/lists/oss-security/2021/09/14/2 Mailing ListPatchThird Party Advisory
http://www.openwall.com/lists/oss-security/2024/01/30/6 ExploitMailing List
http://www.openwall.com/lists/oss-security/2024/01/30/8 Mailing List
https://kc.mcafee.com/corporate/index?page=content&id=SB10348 Broken LinkThird Party Advisory
https://lists.debian.org/debian-lts-announce/2021/01/msg00022.html Mailing ListThird Party Advisory
https://lists.fedoraproject.org/archives/list/package-announce%40lists.fedoraproject.org/message/CALA5FTXIQBRRYUA2ZQNJXB Mailing ListRelease Notes
https://lists.fedoraproject.org/archives/list/package-announce%40lists.fedoraproject.org/message/LHXK6ICO5AYLGFK2TAX5MZK Mailing ListRelease Notes
https://security.gentoo.org/glsa/202101-33 Third Party Advisory
https://security.netapp.com/advisory/ntap-20210128-0001/ Third Party Advisory
https://security.netapp.com/advisory/ntap-20210128-0002/ Third Party Advisory
https://support.apple.com/kb/HT212177 Third Party Advisory
https://tools.cisco.com/security/center/content/CiscoSecurityAdvisory/cisco-sa-sudo-privesc-jan2021-qnYQfcM Third Party Advisory
https://www.beyondtrust.com/blog/entry/security-advisory-privilege-management-for-unix-linux-pmul-basic-and-privilege-ma Third Party Advisory
https://www.debian.org/security/2021/dsa-4839 Third Party Advisory
https://www.kb.cert.org/vuls/id/794544 Third Party AdvisoryUS Government Resource
https://www.openwall.com/lists/oss-security/2021/01/26/3 ExploitMailing ListThird Party Advisory
https://www.oracle.com//security-alerts/cpujul2021.html PatchThird Party Advisory
https://www.oracle.com/security-alerts/cpuapr2022.html PatchThird Party Advisory
https://www.oracle.com/security-alerts/cpuoct2021.html PatchThird Party Advisory
https://www.sudo.ws/stable.html#1.9.5p2 Release Notes
https://www.synology.com/security/advisory/Synology_SA_21_02 Third Party Advisory
https://www.vicarius.io/vsociety/posts/sudoedit-pwned-cve-2021-3156 ExploitThird Party Advisory
http://packetstormsecurity.com/files/161160/Sudo-Heap-Based-Buffer-Overflow.html ExploitThird Party AdvisoryVDB Entry
http://packetstormsecurity.com/files/161230/Sudo-Buffer-Overflow-Privilege-Escalation.html ExploitThird Party AdvisoryVDB Entry
http://packetstormsecurity.com/files/161270/Sudo-1.9.5p1-Buffer-Overflow-Privilege-Escalation.html ExploitThird Party AdvisoryVDB Entry
http://packetstormsecurity.com/files/161293/Sudo-1.8.31p2-1.9.5p1-Buffer-Overflow.html ExploitThird Party AdvisoryVDB Entry
http://packetstormsecurity.com/files/176932/glibc-syslog-Heap-Based-Buffer-Overflow.html ExploitThird Party AdvisoryVDB Entry
http://seclists.org/fulldisclosure/2021/Feb/42 Mailing ListThird Party Advisory

Track CVE-2021-3156 inside VULONE

Watch it alongside the ransomware crews, C2 infrastructure and forum chatter that reference it, query it through the API and pull it into your SIEM over TAXII.

Start free Open in platform

Related vulnerabilities

Same products first, then exploited flaws of the same weakness class.

10.0CVE-2025-32433Erlang/OTP SSH server missing authentication allows remote code executionErlang/OTP SSH servers before OTP-27.3.3, OTP-26.2.5.11 and OTP-25.3.2.20 mishandle SSH protocol messages, letting an unauthenticated attacker execut…KEVEPSS 99%analysed10.0CVE-2025-24201Apple WebKit out-of-bounds write allows sandbox escapeCVE-2025-24201 is an out-of-bounds write in Apple's WebKit that was addressed with improved checks. Maliciously crafted web content may break out of …KEVEPSS 3.8%analysed10.0CVE-2021-44228Apache Log4j2 JNDI lookup remote code executionApache Log4j2 versions 2.0-beta9 through 2.15.0 (excluding 2.12.2, 2.12.3, and 2.3.1) do not protect against attacker-controlled LDAP and other JNDI …KEVEPSS 100%analysed9.8CVE-2026-24061GNU Inetutils telnetd argument injection allows remote auth bypasstelnetd in GNU Inetutils through 2.7 fails to sanitize the USER environment variable, so a value such as "-f root" is passed as an argument to login …KEVEPSS 99%analysed9.8CVE-2025-39682Linux kernel TLS zero-length record handling flaw on rx_listThe Linux kernel TLS receive path mishandles zero-length records that arrive from the rx_list, breaking the assumption that a record type change cann…KEVEPSS 2.9%analysed9.8CVE-2025-24813Apache Tomcat Default Servlet path equivalence enables RCE and file disclosureApache Tomcat mishandles path equivalence for names containing an internal dot, letting a remote unauthenticated attacker write files through the Def…KEVEPSS 100%analysed9.8CVE-2024-9680Mozilla Firefox and Thunderbird use-after-free in Animation timelinesA use-after-free flaw in Animation timelines allows an attacker to execute code in the content process of Firefox and Thunderbird. Mozilla reports ex…KEVEPSS 23%analysed9.8CVE-2024-4577PHP-CGI on Windows argument injection leads to remote code executionPHP-CGI on Windows can misinterpret characters in the command line passed to Win32 API functions when certain code pages are configured, due to Windo…KEVEPSS 100%analysed

Source: NIST National Vulnerability Database (record CVE-2021-3156), CISA KEV, FIRST EPSS (scores of 2026-09-24). This page is refreshed as NVD updates the record.