CVE-2021-3156
Sudo Heap-Based Buffer Overflow Vulnerability
Check your servers for CVE-2021-3156
The Vulnpocalypse collector sends the package list of each Linux server and of its container images once a day. Vulnpocalypse shows every server where CVE-2021-3156 affects a package, with the command that installs the fix. The free plan covers one server and one domain and does not need a credit card.
Known exploited
CISA added this CVE to its list of known exploited vulnerabilities on 6 Apr 2022. US federal agencies had to act by 27 Apr 2022.
- Name
- Sudo Heap-Based Buffer Overflow Vulnerability
- Required action
- Apply updates per vendor instructions.
- Ransomware
- Use in ransomware campaigns is not known
- Notes
- https://nvd.nist.gov/vuln/detail/CVE-2021-3156
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.
Severity (CVSS)
CVSS:3.1/AV:L/AC:L/PR:L/UI:N/S:U/C:H/I:H/A:H
- Attack vector
- local: the attacker needs local access, or a user has to open a prepared file
- Attack complexity
- low: an attack works without special conditions
- Privileges required
- low: the attacker needs an ordinary user account
- User interaction
- none: nobody has to click or open anything
- Scope
- unchanged: the damage stays inside the vulnerable component
- Impact
- confidentiality high, integrity high, availability high: what an attacker can read (confidentiality), change (integrity) or stop (availability)
Exploitation
EPSS 99.9%: the probability of exploitation activity in the next 30 days, from the EPSS model of FIRST. The score is higher than 99.9% of all scored CVEs. Scores of 1 Dec 2026.
The assessment of CISA (SSVC, 3 Feb 2025):
- Exploitation
- active: CISA has reliable evidence of exploitation in the wild
- Automatable
- no: each attack takes manual steps
- Technical impact
- total: full control of the component or of its data
Weakness
- CWE-193 Off-by-one Error
Affected products
As the CNA lists them.
| Product | Versions |
|---|---|
|
n/a
n/a
|
affected all versions
|
Is my server affected?
Find the installed version of the package (replace PACKAGE with its name) and compare it with the fixed version of your distribution. Distributions often fix a CVE in a package version of their own, so the version number of the upstream project can mislead.
Debian, Ubuntu
dpkg -l | grep -i PACKAGE
# packages whose changelog names the CVE (fixed in the installed version)
zgrep -l CVE-2021-3156 /usr/share/doc/*/changelog.Debian.gz
# Ubuntu
pro fix CVE-2021-3156RHEL, Rocky, Alma, Fedora
rpm -q PACKAGE
# lists the advisory while the fix is not installed
dnf updateinfo list --cve CVE-2021-3156Alpine
apk list --installed | grep -i PACKAGEWith Trivy, on the host and for a container image. When a package is affected, it prints the installed and the fixed version:
trivy rootfs --scanners vuln / | grep CVE-2021-3156
trivy image --scanners vuln IMAGE | grep CVE-2021-3156
Vulnpocalypse makes this comparison every day for the package lists of your servers and container images, including language packages (npm, PyPI, Go, Maven and others), and sends the command that installs the fix. Start free with one server and one domain or read how to install the collector.
References
Advisories
- GLSA-202101-33 security.gentoo.org · vendor advisory
- DSA-4839 debian.org · vendor advisory
- FEDORA-2021-2cb63d912a lists.fedoraproject.org · vendor advisory
- FEDORA-2021-8840cbdccd lists.fedoraproject.org · vendor advisory
- 20210129 Sudo Privilege Escalation Vulnerability Affecting Cisco Products: January 2021 tools.cisco.com · vendor advisory
- VU#794544 kb.cert.org · third party advisory
- https://www.cisa.gov/known-exploited-vulnerabilities-catalog?field_cve=CVE-2021-3156 cisa.gov · government resource
Other references
- [debian-lts-announce] 20210126 [SECURITY] [DLA 2534-1] sudo security update lists.debian.org · mailing list
- 20210126 Baron Samedit: Heap-based buffer overflow in Sudo (CVE-2021-3156) seclists.org · mailing list
- [oss-security] 20210126 Baron Samedit: Heap-based buffer overflow in Sudo (CVE-2021-3156) openwall.com · mailing list
- [oss-security] 20210127 Re: Baron Samedit: Heap-based buffer overflow in Sudo (CVE-2021-3156) openwall.com · mailing list
- [oss-security] 20210127 Re: Baron Samedit: Heap-based buffer overflow in Sudo (CVE-2021-3156) openwall.com · mailing list
- 20210211 APPLE-SA-2021-02-09-1 macOS Big Sur 11.2.1, macOS Catalina 10.15.7 Supplemental Update, and macOS Mojave… seclists.org · mailing list
- [oss-security] 20210215 Re: sudo: Ineffective NO_ROOT_MAILER and Baron Samedit openwall.com · mailing list
- https://www.oracle.com//security-alerts/cpujul2021.html oracle.com
- https://www.sudo.ws/stable.html#1.9.5p2 sudo.ws
- https://www.openwall.com/lists/oss-security/2021/01/26/3 openwall.com
- http://packetstormsecurity.com/files/161160/Sudo-Heap-Based-Buffer-Overflow.html packetstormsecurity.com
- https://security.netapp.com/advisory/ntap-20210128-0002/ security.netapp.com
16 more
- https://security.netapp.com/advisory/ntap-20210128-0001/ security.netapp.com
- http://packetstormsecurity.com/files/161230/Sudo-Buffer-Overflow-Privilege-Escalation.html packetstormsecurity.com
- http://packetstormsecurity.com/files/161270/Sudo-1.9.5p1-Buffer-Overflow-Privilege-Escalation.html packetstormsecurity.com
- http://packetstormsecurity.com/files/161293/Sudo-1.8.31p2-1.9.5p1-Buffer-Overflow.html packetstormsecurity.com
- https://support.apple.com/kb/HT212177 support.apple.com
- https://kc.mcafee.com/corporate/index?page=content&id=SB10348 kc.mcafee.com
- 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 beyondtrust.com
- https://www.synology.com/security/advisory/Synology_SA_21_02 synology.com
- [oss-security] 20210914 Re: Oracle Solaris membership in the distros list openwall.com · mailing list
- https://www.oracle.com/security-alerts/cpuoct2021.html oracle.com
- https://www.oracle.com/security-alerts/cpuapr2022.html oracle.com
- [oss-security] 20240130 Re: CVE-2023-6246: Heap-based buffer overflow in the glibc's syslog() openwall.com · mailing list
- [oss-security] 20240130 CVE-2023-6246: Heap-based buffer overflow in the glibc's syslog() openwall.com · mailing list
- http://packetstormsecurity.com/files/176932/glibc-syslog-Heap-Based-Buffer-Overflow.html packetstormsecurity.com
- 20240204 CVE-2023-6246: Heap-based buffer overflow in the glibc's syslog() seclists.org · mailing list
- https://www.vicarius.io/vsociety/posts/sudoedit-pwned-cve-2021-3156 vicarius.io
Source: the record CVE-2021-3156 of the CVE List (CVE Program), CVE Terms of Use; the CISA KEV catalog and the CISA ADP container; EPSS of FIRST; the CWE catalog of MITRE, CWE Terms of Use. The text of the record is shown as published. Data sources and licences.
Vulnpocalypse