{"id":"CVE-2021-3156","details":"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.","modified":"2026-04-16T04:34:59.094665671Z","published":"2021-01-26T21:15:12.987Z","related":["SUSE-SU-2021:0225-1","SUSE-SU-2021:0226-1","SUSE-SU-2021:0227-1","SUSE-SU-2021:0232-1","SUSE-SU-2021:0928-1","SUSE-SU-2021:1267-1","SUSE-SU-2021:1273-1","SUSE-SU-2021:1274-1","SUSE-SU-2021:1275-1","SUSE-SU-2024:4389-1","openSUSE-SU-2021:0169-1","openSUSE-SU-2021:0170-1","openSUSE-SU-2021:0602-1","openSUSE-SU-2024:11413-1"],"references":[{"type":"WEB","url":"https://www.cisa.gov/known-exploited-vulnerabilities-catalog?field_cve=CVE-2021-3156"},{"type":"ADVISORY","url":"https://lists.fedoraproject.org/archives/list/package-announce%40lists.fedoraproject.org/message/LHXK6ICO5AYLGFK2TAX5MZKUXTUKWOJY/"},{"type":"ADVISORY","url":"https://support.apple.com/kb/HT212177"},{"type":"ADVISORY","url":"https://security.gentoo.org/glsa/202101-33"},{"type":"ADVISORY","url":"https://security.netapp.com/advisory/ntap-20210128-0002/"},{"type":"ADVISORY","url":"https://www.kb.cert.org/vuls/id/794544"},{"type":"ADVISORY","url":"http://www.openwall.com/lists/oss-security/2021/01/27/1"},{"type":"ADVISORY","url":"https://lists.debian.org/debian-lts-announce/2021/01/msg00022.html"},{"type":"ADVISORY","url":"http://seclists.org/fulldisclosure/2021/Feb/42"},{"type":"ADVISORY","url":"https://www.sudo.ws/stable.html#1.9.5p2"},{"type":"ADVISORY","url":"https://security.netapp.com/advisory/ntap-20210128-0001/"},{"type":"ADVISORY","url":"https://tools.cisco.com/security/center/content/CiscoSecurityAdvisory/cisco-sa-sudo-privesc-jan2021-qnYQfcM"},{"type":"ADVISORY","url":"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"},{"type":"ADVISORY","url":"https://www.debian.org/security/2021/dsa-4839"},{"type":"ADVISORY","url":"http://www.openwall.com/lists/oss-security/2021/01/27/2"},{"type":"ADVISORY","url":"https://www.synology.com/security/advisory/Synology_SA_21_02"},{"type":"ADVISORY","url":"https://kc.mcafee.com/corporate/index?page=content&id=SB10348"},{"type":"ADVISORY","url":"https://lists.fedoraproject.org/archives/list/package-announce%40lists.fedoraproject.org/message/CALA5FTXIQBRRYUA2ZQNJXB6OQMAXEII/"},{"type":"FIX","url":"https://www.oracle.com/security-alerts/cpuapr2022.html"},{"type":"FIX","url":"https://www.oracle.com/security-alerts/cpuoct2021.html"},{"type":"FIX","url":"http://www.openwall.com/lists/oss-security/2021/09/14/2"},{"type":"FIX","url":"https://www.oracle.com//security-alerts/cpujul2021.html"},{"type":"ARTICLE","url":"http://www.openwall.com/lists/oss-security/2024/01/30/8"},{"type":"EVIDENCE","url":"https://www.vicarius.io/vsociety/posts/sudoedit-pwned-cve-2021-3156"},{"type":"EVIDENCE","url":"http://www.openwall.com/lists/oss-security/2021/01/26/3"},{"type":"EVIDENCE","url":"http://seclists.org/fulldisclosure/2024/Feb/3"},{"type":"EVIDENCE","url":"http://www.openwall.com/lists/oss-security/2024/01/30/6"},{"type":"EVIDENCE","url":"http://packetstormsecurity.com/files/176932/glibc-syslog-Heap-Based-Buffer-Overflow.html"},{"type":"EVIDENCE","url":"https://www.openwall.com/lists/oss-security/2021/01/26/3"},{"type":"EVIDENCE","url":"http://packetstormsecurity.com/files/161160/Sudo-Heap-Based-Buffer-Overflow.html"},{"type":"EVIDENCE","url":"http://packetstormsecurity.com/files/161270/Sudo-1.9.5p1-Buffer-Overflow-Privilege-Escalation.html"},{"type":"EVIDENCE","url":"http://packetstormsecurity.com/files/161293/Sudo-1.8.31p2-1.9.5p1-Buffer-Overflow.html"},{"type":"EVIDENCE","url":"http://seclists.org/fulldisclosure/2021/Jan/79"},{"type":"EVIDENCE","url":"http://www.openwall.com/lists/oss-security/2021/02/15/1"},{"type":"EVIDENCE","url":"http://packetstormsecurity.com/files/161230/Sudo-Buffer-Overflow-Privilege-Escalation.html"}],"affected":[{"ranges":[{"type":"GIT","repo":"https://github.com/millert/sudo","events":[{"introduced":"82d8358a72b1e8784b5399c1ecb5d271ae91e125"},{"fixed":"caa666c2dfa1f4286ccfbed5e512432665b72d3a"},{"introduced":"83d1bee918147a57804de77d3e1064a4e323f47e"},{"fixed":"10d072a320c885e2e805ef2e47fe7a2ebde68abc"},{"introduced":"0"},{"last_affected":"10d072a320c885e2e805ef2e47fe7a2ebde68abc"},{"introduced":"0"},{"last_affected":"8a0373679a24306a2dc57677dbc6d87d1611c8bc"}],"database_specific":{"versions":[{"introduced":"1.8.2"},{"fixed":"1.8.32"},{"introduced":"1.9.0"},{"fixed":"1.9.5"},{"introduced":"0"},{"last_affected":"1.9.5-NA"},{"introduced":"0"},{"last_affected":"1.9.5-patch1"}]}}],"versions":["SUDO_1_8_10","SUDO_1_8_10p1","SUDO_1_8_10p2","SUDO_1_8_10p3","SUDO_1_8_11","SUDO_1_8_11p1","SUDO_1_8_11p2","SUDO_1_8_12","SUDO_1_8_13","SUDO_1_8_14","SUDO_1_8_14p1","SUDO_1_8_14p3","SUDO_1_8_15","SUDO_1_8_16","SUDO_1_8_17","SUDO_1_8_17p1","SUDO_1_8_18","SUDO_1_8_18p1","SUDO_1_8_19","SUDO_1_8_19p1","SUDO_1_8_19p2","SUDO_1_8_2","SUDO_1_8_20","SUDO_1_8_20p1","SUDO_1_8_20p2","SUDO_1_8_21","SUDO_1_8_21p1","SUDO_1_8_21p2","SUDO_1_8_22","SUDO_1_8_23","SUDO_1_8_24","SUDO_1_8_25","SUDO_1_8_25p1","SUDO_1_8_26","SUDO_1_8_27","SUDO_1_8_28","SUDO_1_8_28p1","SUDO_1_8_29","SUDO_1_8_3","SUDO_1_8_30","SUDO_1_8_31","SUDO_1_8_31p1","SUDO_1_8_31p2","SUDO_1_8_4","SUDO_1_8_4p1","SUDO_1_8_4p2","SUDO_1_8_4p3","SUDO_1_8_4p4","SUDO_1_8_4p5","SUDO_1_8_5","SUDO_1_8_5p1","SUDO_1_8_5p2","SUDO_1_8_5p3","SUDO_1_8_6","SUDO_1_8_6p1","SUDO_1_8_6p2","SUDO_1_8_6p3","SUDO_1_8_6p4","SUDO_1_8_6p5","SUDO_1_8_6p6","SUDO_1_8_6p7","SUDO_1_8_6p8","SUDO_1_8_7","SUDO_1_8_8","SUDO_1_8_9","SUDO_1_8_9p1","SUDO_1_8_9p2","SUDO_1_8_9p3","SUDO_1_8_9p4","SUDO_1_8_9p5","SUDO_1_9_0","SUDO_1_9_1","SUDO_1_9_2","SUDO_1_9_3","SUDO_1_9_3p1","SUDO_1_9_4","SUDO_1_9_4p1","SUDO_1_9_4p2","SUDO_1_9_5","SUDO_1_9_5p1"],"database_specific":{"source":"https://storage.googleapis.com/cve-osv-conversion/osv-output/CVE-2021-3156.json","unresolved_ranges":[{"events":[{"introduced":"0"},{"last_affected":"32"}]},{"events":[{"introduced":"0"},{"last_affected":"33"}]},{"events":[{"introduced":"0"},{"last_affected":"9.0"}]},{"events":[{"introduced":"0"},{"last_affected":"10.0"}]},{"events":[{"introduced":"0"},{"last_affected":"9"}]},{"events":[{"introduced":"0"},{"last_affected":"8.2.17"}]},{"events":[{"introduced":"0"},{"last_affected":"9.2.8"}]},{"events":[{"introduced":"0"},{"last_affected":"10.0.4"}]},{"events":[{"introduced":"0"},{"last_affected":"3.0"}]},{"events":[{"introduced":"0"},{"last_affected":"6.2"}]},{"events":[{"introduced":"0"},{"fixed":"21.1.1"}]},{"events":[{"introduced":"0"},{"fixed":"10.3.2-10"}]},{"events":[{"introduced":"0"},{"last_affected":"310"}]},{"events":[{"introduced":"400"},{"last_affected":"410"}]},{"events":[{"introduced":"0"},{"last_affected":"210"}]},{"events":[{"introduced":"0"},{"last_affected":"5a"}]},{"events":[{"introduced":"610"},{"last_affected":"655"}]},{"events":[{"introduced":"10.3.0.0.0"},{"last_affected":"10.3.0.2.1"}]},{"events":[{"introduced":"10.4.0.1.0"},{"last_affected":"10.4.0.3.1"}]},{"events":[{"introduced":"7.4.0"},{"last_affected":"7.7.1"}]}]}}],"schema_version":"1.7.5","severity":[{"type":"CVSS_V3","score":"CVSS:3.1/AV:L/AC:L/PR:L/UI:N/S:U/C:H/I:H/A:H"}]}