# CVE-2021-3156: Sudo Heap-Based Buffer Overflow Vulnerability

Source: https://junglewise.ai/threats/cve-2021-3156-sudo-heap-based-buffer-overflow-vulnerability  
Publisher: Junglewise Threat Intelligence, https://junglewise.ai/threats  
Published: 2022-04-06. Updated: 2026-05-10  
License: CC BY 4.0 with a link back

CVE-2021-3156 · Severity: critical · CVSS 7.8 · Exploited in the wild · Published 2022-04-06

Sudo contains an off-by-one error leading to a heap-based buffer overflow. An attacker can achieve root privilege escalation by using 'sudoedit -s' with a command-line argument ending in a single backslash.

Technologies: [Sudo](https://junglewise.ai/threats/technologies/sudo). Vendors: [Sudo](https://junglewise.ai/threats/vendors/sudo).

## Quick answers

**Is CVE-2021-3156 exploited in the wild?** Yes. CVE-2021-3156 is known to be exploited in the wild, first recorded on 6 April 2022. Treat it as urgent.

**How severe is CVE-2021-3156?** Critical severity, with a CVSS score of 7.8, published 6 April 2022.

**Which products and versions are affected?** Sudo Project Sudo before 1.9.5p2.

**Is there a fix for CVE-2021-3156?** No fixed version is recorded yet. Check the vendor's advisory in the references below. If you run it, Junglewise drafts a mitigation that fits your setup and applies it once you approve, with senior security engineers behind it.

**How is CVE-2021-3156 attacked?** It is attacked with local access, in an operating system.

**Am I affected by CVE-2021-3156?** Check whether you run Sudo. Junglewise does that check for you around the clock: connect your code, cloud and domains, and it matches new vulnerabilities like this one against what you actually run and tells you when one reaches you.

## Affected products

- Sudo Project Sudo before 1.9.5p2

## Timeline

- 2021-01-26: disclosed: Initial public disclosure via Openwall and other sources.
- 2022-04-06: kev added: Added to CISA Known Exploited Vulnerabilities Catalog.
- 2022-04-06: other: Published date listed in advisory.

## Related threats

- [Sudo privilege escalation via untrusted chroot configuration](https://junglewise.ai/threats/cve-2025-32463-sudo-privilege-escalation-via-untrusted-chroot-configuration)
