draft preview · not published · notes marked "Before launch" will not appear on the live site

Home / Known exploited

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

Exploited in attacksPublic exploit code

Yes. CVE-2021-3156 has been used in real attacks. CISA added it to its Known Exploited Vulnerabilities catalog on 6 April 2022. Public exploit code is available: 1 Metasploit module and 2 Exploit-DB entries. EPSS puts the chance of further exploitation attempts in the next 30 days at 99.9%.

Exploited in real attacks
Yes. On CISA's exploited list since 6 April 2022
Used in ransomware
Not known
Public exploit code
1 Metasploit module and 2 Exploit-DB entries
Chance of exploitation (EPSS)
99.9% in the next 30 days, higher than 99.9% of scored vulnerabilities. Scored 5 December 2026
Severity (CVSS)
7.8 High (version 3.1)
Affects
Sudo Sudo
Type of flaw
Off-by-one Error (CWE-193)
Published
26 January 2021
US federal patch deadline
27 April 2022

What it is

Sudo contains an off-by-one error that can result in a heap-based buffer overflow, which allows for privilege escalation.

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.

Description from the CVE record.

Is CVE-2021-3156 being exploited?

Yes. CISA lists a vulnerability as known exploited only when it has reliable evidence of exploitation in real attacks, and it added CVE-2021-3156 on 6 April 2022. That was 1 year after the CVE was published, so attackers are still finding unpatched systems long after the fix.

Public exploit code

These are public references that anyone, including an attacker, can find. Their existence lowers the skill needed to use the flaw.

What to do

CISA's required action: Apply updates per vendor instructions.

Because this flaw has already been used in attacks, patching is only half the job. If an affected system was reachable while unpatched, check it for signs of compromise before trusting it again.

How to check whether you are exposed

  1. Find every copy. List each place Sudo runs, including test systems and anything set up outside IT.
  2. Compare versions. Match what you find against the affected versions in the vendor advisory.
  3. Check reachability. An affected system that faces the internet is urgent; one reachable only from inside still matters once an attacker has a foothold.
  4. Assume low-skill attackers can use it. A Metasploit module exists, which packages the attack into a standard tool.

HackDrill

Find out whether this is reachable in your systems.

A version number tells you a system is affected. A hacking drill tells you whether an attacker can actually get in through a flaw like this one in Sudo. HackDrill's AI agents attack your product, infrastructure, network and cloud the way modern attackers do, and show you the real, exploitable gaps so you can fix them first.

Sources

Machine-readable: /api/cve/CVE-2021-3156.json