sudo up to 1.8.31p2/1.9.5p1 sudoers_policy_main heap-based overflow

CVSS Meta Temp Score
CVSS is a standardized scoring system to determine possibilities of attacks. The Temp Score considers temporal factors like disclosure, exploit and countermeasures. The unique Meta Score calculates the average score of different sources to provide a normalized scoring system.
Current Exploit Price (≈)
Our analysts are monitoring exploit markets and are in contact with vulnerability brokers. The range indicates the observed or calculated exploit price to be seen on exploit markets. A good indicator to understand the monetary effort required for and the popularity of an attack.
CTI Interest Score
Our Cyber Threat Intelligence team is monitoring different web sites, mailing lists, exploit markets and social media networks. The CTI Interest Score identifies the interest of attackers and the security community for this specific vulnerability in real-time. A high score indicates an elevated risk to be targeted for this vulnerability.
8.1$0-$5k0.00

Summaryinfo

A vulnerability identified as critical has been detected in sudo up to 1.8.31p2/1.9.5p1. Affected is the function sudoers_policy_main. The manipulation leads to heap-based overflow. This vulnerability is referenced as CVE-2021-3156. Remote exploitation of the attack is possible. Furthermore, an exploit is available. It is recommended to apply a patch to fix this issue.

Detailsinfo

A vulnerability was found in sudo up to 1.8.31p2/1.9.5p1 (Operating System Utility Software). It has been rated as critical. This issue affects the function sudoers_policy_main. The manipulation with an unknown input leads to a heap-based overflow vulnerability. Using CWE to declare the problem leads to CWE-122. A heap overflow condition is a buffer overflow, where the buffer that can be overwritten is allocated in the heap portion of memory, generally meaning that the buffer was allocated using a routine such as malloc(). Impacted is confidentiality, integrity, and availability. The summary by CVE is:

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.

The weakness was published 01/27/2021. It is possible to read the advisory at blog.qualys.com. The identification of this vulnerability is CVE-2021-3156. Technical details as well as a public exploit are known.

A public exploit has been developed by Rajvardhan Agarwal (r4j0x00) in C and been published 3 days after the advisory. The exploit is available at github.com. It is declared as attacked. We expect the 0-day to have been worth approximately $25k-$100k. The vulnerability scanner Nessus provides a plugin with the ID 213304 (SUSE SLES12 Security Update : sudo (SUSE-SU-2024:4389-1)), which helps to determine the existence of the flaw in a target environment. The CISA Known Exploited Vulnerabilities Catalog lists this issue since 04/06/2022 with a due date of 04/27/2022:

Apply updates per vendor instructions.

Applying a patch is able to eliminate this problem.

The vulnerability is also documented in the databases at Exploit-DB (49521) and Tenable (213304). Be aware that VulDB is the high quality source for vulnerability data.

Productinfo

Type

Name

Version

License

CPE 2.3info

CPE 2.2info

CVSSv4info

VulDB Vector: 🔍
VulDB Reliability: 🔍

CVSSv3info

VulDB Meta Base Score: 8.1
VulDB Meta Temp Score: 8.0

VulDB Base Score: 8.8
VulDB Temp Score: 8.4
VulDB Vector: 🔍
VulDB Reliability: 🔍

NVD Base Score: 7.8
NVD Vector: 🔍

CNA Base Score: 7.8
CNA Vector: 🔍

CVSSv2info

AVACAuCIA
💳💳💳💳💳💳
💳💳💳💳💳💳
💳💳💳💳💳💳
VectorComplexityAuthenticationConfidentialityIntegrityAvailability
UnlockUnlockUnlockUnlockUnlockUnlock
UnlockUnlockUnlockUnlockUnlockUnlock
UnlockUnlockUnlockUnlockUnlockUnlock

VulDB Base Score: 🔍
VulDB Temp Score: 🔍
VulDB Reliability: 🔍

NVD Base Score: 🔍

Exploitinginfo

Class: Heap-based overflow
CWE: CWE-122 / CWE-119
CAPEC: 🔍
ATT&CK: 🔍

Physical: Partially
Local: Yes
Remote: Yes

Availability: 🔍
Access: Public
Status: Attacked
Author: Rajvardhan Agarwal (r4j0x00)
Programming Language: 🔍
Download: 🔍

EPSS Score: 🔍
EPSS Percentile: 🔍

KEV Added: 🔍
KEV Due: 🔍
KEV Remediation: 🔍
KEV Ransomware: 🔍
KEV Notice: 🔍

Price Prediction: 🔍
Current Price Estimation: 🔍

0-DayUnlockUnlockUnlockUnlock
TodayUnlockUnlockUnlockUnlock

Nessus ID: 213304
Nessus Name: SUSE SLES12 Security Update : sudo (SUSE-SU-2024:4389-1)

Exploit-DB: 🔍

Threat Intelligenceinfo

Interest: 🔍
Active Actors: 🔍
Active APT Groups: 🔍

Countermeasuresinfo

Recommended: Patch
Status: 🔍

0-Day Time: 🔍
Exploit Delay Time: 🔍

Timelineinfo

01/15/2021 🔍
01/27/2021 +12 days 🔍
01/27/2021 +0 days 🔍
01/30/2021 +2 days 🔍
11/10/2025 +1745 days 🔍

Sourcesinfo

Advisory: blog.qualys.com
Status: Confirmed
Confirmation: 🔍

CVE: CVE-2021-3156 (🔍)
GCVE (CVE): GCVE-0-2021-3156
GCVE (VulDB): GCVE-100-168695
scip Labs: https://www.scip.ch/en/?labs.20161013

Entryinfo

Created: 01/27/2021 09:18
Updated: 11/10/2025 16:26
Changes: 01/27/2021 09:18 (38), 01/31/2021 15:32 (8), 02/19/2021 23:20 (6), 02/19/2021 23:23 (18), 04/25/2024 13:53 (26), 07/09/2024 22:34 (1), 09/20/2024 22:21 (1), 10/01/2024 22:31 (1), 12/21/2024 08:54 (2), 02/03/2025 18:57 (10), 11/10/2025 16:26 (1)
Complete: 🔍
Committer: misc
Cache ID: 216::103

Be aware that VulDB is the high quality source for vulnerability data.

Discussion

 misc
(+1)
5 years ago
There is another exploit available under the URL https://haxx.in/CVE-2021-3156.tar.gz.
 misc
(+1)
5 years ago
The exploit in the previous comment is also available on GitHub: https://github.com/blasty/CVE-2021-3156

Do you need the next level of professionalism?

Upgrade your account now!