--- title: "CVE-2021-3156: Off-by-one Error | CubePath" 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…" language: en source: https://cubepath.com/security/cve/CVE-2021-3156 --- # CVE-2021-3156: Off-by-one Error | CubePath ## 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. Official description from the CVE record, published by mitre. Copyright © 1999-2026 The MITRE Corporation. See [/security/cve/legal](https://cubepath.com/security/cve/legal) for the CVE license. [View the record on cve.org](https://www.cve.org/CVERecord?id=CVE-2021-3156) ## Key data ### CVSS 3.1 High 7.8 Score published by CISA-ADP in the CVE record. CVSS:3.1/AV:L/AC:L/PR:L/UI:N/S:U/C:H/I:H/A:H | Metric | Value | What it means | | ---------------------- | --------- | ----------------------------------------------------------------------------------------- | | Attack vector | Local | The attacker needs local access to the system, or to trick a user into running something. | | Attack complexity | Low | No special conditions are needed. The attack can be repeated at will. | | Privileges required | Low | A basic user account is needed. | | User interaction | None | No action from any user is needed. | | Scope | Unchanged | The impact stays within the vulnerable component. | | Confidentiality impact | High | Serious or total effect on the secrecy of data. | | Integrity impact | High | Serious or total effect on the trustworthiness of data. | | Availability impact | High | Serious or total effect on availability. | CVSS is owned and managed by FIRST.Org, Inc. (FIRST) and is used by permission. Each CVSS score on this site is shown together with its vector string, as published in the CVE record by the source named next to it. Learn more at [first.org/cvss](https://www.first.org/cvss/) . ### EPSS Exploit Prediction Scoring System by FIRST: an estimate of the probability that exploitation activity will be observed in the next 30 days. Score 0.99962 (99.96% probability) Percentile 99.97% Scores of Nov 10, 2026 Model v2026.06.15 ### CISA Known Exploited Vulnerabilities This CVE is listed in the CISA KEV catalog. Name in the catalog Sudo Heap-Based Buffer Overflow Vulnerability Added to the catalog Apr 6, 2022 Federal due date Apr 27, 2022 ### CISA assessment as of Feb 3, 2025 Stakeholder-Specific Vulnerability Categorization (SSVC) decision points added by CISA. Exploitation Recorded by CISA as active Automatable no Technical impact total ### Weakness (CWE) CWE catalog version 5.0. CWE names: Copyright © 2006-2026, The MITRE Corporation. See [/security/cve/legal](https://cubepath.com/security/cve/legal) for the CWE license. - [CWE-193](https://cwe.mitre.org/data/definitions/193.html) Off-by-one Error ## References Links listed in the CVE record. They lead to other sites, which CubePath does not control. - [\[debian-lts-announce\] 20210126 \[SECURITY\] \[DLA 2534-1\] sudo security update](https://lists.debian.org/debian-lts-announce/2021/01/msg00022.html) (lists.debian.org) mailing-list - [20210126 Baron Samedit: Heap-based buffer overflow in Sudo (CVE-2021-3156)](http://seclists.org/fulldisclosure/2021/Jan/79) (seclists.org) mailing-list - [\[oss-security\] 20210126 Baron Samedit: Heap-based buffer overflow in Sudo (CVE-2021-3156)](http://www.openwall.com/lists/oss-security/2021/01/26/3) (openwall.com) mailing-list - [GLSA-202101-33](https://security.gentoo.org/glsa/202101-33) (security.gentoo.org) vendor-advisory - [DSA-4839](https://www.debian.org/security/2021/dsa-4839) (debian.org) vendor-advisory - [FEDORA-2021-2cb63d912a](https://lists.fedoraproject.org/archives/list/package-announce%40lists.fedoraproject.org/message/LHXK6ICO5AYLGFK2TAX5MZKUXTUKWOJY/) (lists.fedoraproject.org) vendor-advisory - [FEDORA-2021-8840cbdccd](https://lists.fedoraproject.org/archives/list/package-announce%40lists.fedoraproject.org/message/CALA5FTXIQBRRYUA2ZQNJXB6OQMAXEII/) (lists.fedoraproject.org) vendor-advisory - [\[oss-security\] 20210127 Re: Baron Samedit: Heap-based buffer overflow in Sudo (CVE-2021-3156)](http://www.openwall.com/lists/oss-security/2021/01/27/1) (openwall.com) mailing-list - [\[oss-security\] 20210127 Re: Baron Samedit: Heap-based buffer overflow in Sudo (CVE-2021-3156)](http://www.openwall.com/lists/oss-security/2021/01/27/2) (openwall.com) mailing-list - [20210129 Sudo Privilege Escalation Vulnerability Affecting Cisco Products: January 2021](https://tools.cisco.com/security/center/content/CiscoSecurityAdvisory/cisco-sa-sudo-privesc-jan2021-qnYQfcM) (tools.cisco.com) vendor-advisory - [VU#794544](https://www.kb.cert.org/vuls/id/794544) (kb.cert.org) third-party-advisory - [20210211 APPLE-SA-2021-02-09-1 macOS Big Sur 11.2.1, macOS Catalina 10.15.7 Supplemental Update, and macOS Mojave 10.14.6 Security Update 2021-002](http://seclists.org/fulldisclosure/2021/Feb/42) (seclists.org) mailing-list - [\[oss-security\] 20210215 Re: sudo: Ineffective NO\_ROOT\_MAILER and Baron Samedit](http://www.openwall.com/lists/oss-security/2021/02/15/1) (openwall.com) mailing-list - [oracle.com//security-alerts/cpujul2021.html](https://www.oracle.com//security-alerts/cpujul2021.html) - [sudo.ws/stable.html](https://www.sudo.ws/stable.html#1.9.5p2) - [openwall.com/lists/oss-security/2021/01/26/3](https://www.openwall.com/lists/oss-security/2021/01/26/3) - [packetstormsecurity.com/files/161160/Sudo-Heap-Based-Buffer…](http://packetstormsecurity.com/files/161160/Sudo-Heap-Based-Buffer-Overflow.html) - [security.netapp.com/advisory/ntap-20210128-0002](https://security.netapp.com/advisory/ntap-20210128-0002/) - [security.netapp.com/advisory/ntap-20210128-0001](https://security.netapp.com/advisory/ntap-20210128-0001/) - [packetstormsecurity.com/files/161230/Sudo-Buffer-Overflow-P…](http://packetstormsecurity.com/files/161230/Sudo-Buffer-Overflow-Privilege-Escalation.html) - [packetstormsecurity.com/files/161270/Sudo-1.9.5p1-Buffer-Ov…](http://packetstormsecurity.com/files/161270/Sudo-1.9.5p1-Buffer-Overflow-Privilege-Escalation.html) - [packetstormsecurity.com/files/161293/Sudo-1.8.31p2-1.9.5p1-…](http://packetstormsecurity.com/files/161293/Sudo-1.8.31p2-1.9.5p1-Buffer-Overflow.html) - [support.apple.com/kb/HT212177](https://support.apple.com/kb/HT212177) - [kc.mcafee.com/corporate/index?page=content&id=SB10348](https://kc.mcafee.com/corporate/index?page=content&id=SB10348) - [beyondtrust.com/blog/entry/security-advisory-privilege-mana…](https://www.beyondtrust.com/blog/entry/security-advisory-privilege-management-for-unix-linux-pmul-basic-and-privilege-management-for-mac-pmm-affected-by-sudo-vulnerability) - [synology.com/security/advisory/Synology\_SA\_21\_02](https://www.synology.com/security/advisory/Synology%5FSA%5F21%5F02) - [\[oss-security\] 20210914 Re: Oracle Solaris membership in the distros list](http://www.openwall.com/lists/oss-security/2021/09/14/2) (openwall.com) mailing-list - [oracle.com/security-alerts/cpuoct2021.html](https://www.oracle.com/security-alerts/cpuoct2021.html) - [oracle.com/security-alerts/cpuapr2022.html](https://www.oracle.com/security-alerts/cpuapr2022.html) - [\[oss-security\] 20240130 Re: CVE-2023-6246: Heap-based buffer overflow in the glibc's syslog()](http://www.openwall.com/lists/oss-security/2024/01/30/8) (openwall.com) mailing-list - [\[oss-security\] 20240130 CVE-2023-6246: Heap-based buffer overflow in the glibc's syslog()](http://www.openwall.com/lists/oss-security/2024/01/30/6) (openwall.com) mailing-list - [packetstormsecurity.com/files/176932/glibc-syslog-Heap-Base…](http://packetstormsecurity.com/files/176932/glibc-syslog-Heap-Based-Buffer-Overflow.html) - [20240204 CVE-2023-6246: Heap-based buffer overflow in the glibc's syslog()](http://seclists.org/fulldisclosure/2024/Feb/3) (seclists.org) mailing-list - [vicarius.io/vsociety/posts/sudoedit-pwned-cve-2021-3156](https://www.vicarius.io/vsociety/posts/sudoedit-pwned-cve-2021-3156) ## Timeline 1. ID reserved Jan 15, 2021 2. Record published Jan 26, 2021 3. Added to CISA KEV Apr 6, 2022 4. Record last updated Oct 21, 2025 ## Look up another CVE ## About CubePath CubePath is a cloud provider with data centers in Europe and the United States. It offers VPS, bare metal servers and DDoS protection. [Cloud VPS](https://cubepath.com/vps) [DDoS protection](https://cubepath.com/ddos-protection) Data from the CVE Program (MITRE), CISA KEV and FIRST EPSS. CVSS is owned by FIRST and used by permission. Not affiliated with or endorsed by MITRE, CISA or FIRST. Data as of Nov 10, 2026, 20:03 UTC. [Sources and licenses](https://cubepath.com/security/cve/legal)