CVE-2021-3156 — sudo
HIGHCVE-2021-3156 is a high-severity (CVSS 7.8) CWE-193 vulnerability. It is in CISA's Known Exploited Vulnerabilities catalog (added 2022-04-06) — treat it as actively exploited and patch now. A fix is available — see the affected versions and patch details below.
Exploitation Status
Actively exploited in the wild
- Confirmed by CISA's Known Exploited Vulnerabilities catalog on 2022-04-06. Federal agencies were required to remediate by 2022-04-27.
- A successful exploit gives an attacker total control of the affected component, not partial access.
Exploitation and automatability from CISA (KEV catalog and SSVC triage) for CVE-2021-3156.
EPSS Exploitation Probability
Probability of exploitation in the next 30 days, from FIRST.org EPSS.
How urgent is this, really
CVE-2021-3156 by exploitation likelihood (EPSS) against impact (CVSS). In the shaded patch-first corner (EPSS 50%+, CVSS 7.0+).
Where this sits among everything scored
Of 394,803 CVEs with a current EPSS score, this one falls in the ≥ 90% band (highlighted). Counts from FIRST.org, log-scaled.
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.
Affected Products
privilege management for macbeyondtrustprivilege management for unix\/linuxbeyondtrustdebian linuxdebianfedorafedoraprojectweb gatewaymcafeeactive iq unified managernetappResearch use only. For defensive security, authorized penetration testing, and academic research only. Never execute exploit code against systems without explicit written authorization.
Sudo 1.9.5p1 - 'Baron Samedit ' Heap-Based Buffer Overflow Privilege Escalation (2)
by nu11secur1ty · Feb 3, 2021
Sudo 1.9.5p1 - 'Baron Samedit ' Heap-Based Buffer Overflow Privilege Escalation (1)
by West Shepherd · Feb 3, 2021
Detection & mitigation playbook
VulnerabilityDetect
Identify every host running the affected component and compare the installed build against the fixed version below — for source-built or distro-packaged software the version string, not a lockfile, is the source of truth (`dpkg -l`, `rpm -q`, or the binary's own `--version`).
Fix
Upgrade the affected component to the fixed release for CVE-2021-3156, or apply your distribution's backported patch — distro builds are often patched at an older version number, so check your vendor's advisory rather than the upstream version alone.
Workarounds
Constrain what reaches the vulnerable code: limit the size and shape of untrusted input, isolate the affected component in a sandboxed or least-privileged process, and enable the platform's memory-safety mitigations (ASLR, stack protector, hardened allocator) so an out-of-bounds access is more likely to fail closed than to be exploitable.
Fixing This On Your OS
If you run this on a Linux distribution, patch through your package manager against the distro's own security advisory below — it tracks the exact backported fix for your release, which can ship on a different timeline (and sometimes a different severity) than the upstream project.
This flaw does not affect the versions of sudo shipped with Red Hat Enterprise Linux 5, because the vulnerable code was not present in these versions.
Red Hat Product Security strongly recommends customers to update to fixed sudo packages once they are available. For customers who cannot update immediately, the following interim partial mitigation using systemtap is suggested: 1. Install required systemtap packages and dependencies: ``` systemtap yum-utils kernel-devel-"$(uname -r)" ``` Then for RHEL 7 install kernel debuginfo, using: ``` debuginfo-install -y kernel-"$(uname -r)" ``` Then for RHEL 8 & 6 install sudo debuginfo, using: ``` debuginfo-install sudo ``` 2. Create the following systemtap script: (call the file as sudoedit-block.stap) ``` probe process("/usr/bin/sudo").function("main") { command = cmdline_args(0,0,""); if…Source: Red Hat security advisory for CVE-2021-3156 (CC BY 4.0)
| Product | Fixed in | Advisory |
|---|---|---|
| Red Hat Enterprise Linux 6 Extended Lifecycle Support | sudo-0:1.8.6p3-29.el6_10.4 | RHSA-2021:0227 |
| Red Hat Enterprise Linux 7 | sudo-0:1.8.23-10.el7_9.1 | RHSA-2021:0221 |
| Red Hat Enterprise Linux 7.2 Advanced Update Support | sudo-0:1.8.6p7-17.el7_2.3 | RHSA-2021:0226 |
| Red Hat Enterprise Linux 7.3 Advanced Update Support | sudo-0:1.8.6p7-23.el7_3.3 | RHSA-2021:0225 |
| Red Hat Enterprise Linux 7.4 Advanced Update Support | sudo-0:1.8.19p2-12.el7_4.2 | RHSA-2021:0224 |
| Red Hat Enterprise Linux 7.6 Extended Update Support | sudo-0:1.8.23-3.el7_6.2 | RHSA-2021:0223 |
| Red Hat Enterprise Linux 7.7 Extended Update Support | sudo-0:1.8.23-4.el7_7.3 | RHSA-2021:0222 |
| Red Hat Enterprise Linux 8 | sudo-0:1.8.29-6.el8_3.1 | RHSA-2021:0218 |
Frequently Asked Questions
Is CVE-2021-3156 in your dependencies?
Find it across , including transitive dependencies.