Skip to content
KitploitKITPLOIT
ToolsExploitsBlog
Log in
Submit
ToolsExploitsBlog
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.

FeedsContactPrivacy© 2026 Kitploit

Tool Directory

Categories

View all categories
Loading categories
CVE-2021-3156-Sudo-Buffer-Overflow-Linux — Red Team exploitation of CVE-2021-3156 (Baron Samedit) – Heap Buffer Overflow in Sudo leading to Local Privilege Escalation on Ubuntu 20.04 | Kitploit
Tools/GitHubGitHub/rana-ali93/cve-2021-3156-sudo-buffer-overflow-linux
Privilege EscalationVulnerability AnalysisExploitationPenetration TestingLearning & EducationRed TeamingBinary ExploitationLabs & Practice
Share
GitHub
rana-ali93/cve-2021-3156-sudo-buffer-overflow-linux

CVE-2021-3156-Sudo-Buffer-Overflow-Linux

Red Team exploitation of CVE-2021-3156 (Baron Samedit) – Heap Buffer Overflow in Sudo leading to Local Privilege Escalation on Ubuntu 20.04

View Repository
218 months agoNot yet reviewed

CVE-2021-3156 – Sudo Buffer Overflow (Linux)

Baron Samedit Privilege Escalation Exploit


📌 Overview

This project demonstrates the exploitation of CVE-2021-3156 (Baron Samedit), a critical heap-based buffer overflow vulnerability in the Linux sudo utility.

The vulnerability allows a low-privileged user to gain root access through improper argument handling in sudoedit.


🎯 Objectives

  • Analyze vulnerability root cause
  • Build a vulnerable Linux environment
  • Execute public exploit code
  • Achieve local privilege escalation
  • Document Red Team attack workflow

🛠️ Lab Environment

ComponentDetails
OSUbuntu 20.04
RAM2 GB
CPU2 Cores
VirtualizationVirtualBox
NetworkNAT

⚠️ Vulnerability Details

  • CVE ID: CVE-2021-3156
  • Name: Baron Samedit
  • Type: Heap Buffer Overflow
  • Impact: Local Privilege Escalation
  • Severity: Critical

This vulnerability affects the sudo program and enables attackers to execute arbitrary code with root privileges.


⚙️ Exploitation Process

  1. Verified vulnerable sudo version
  2. Installed required tools (gcc, git, make)
  3. Created low-privileged user
  4. Cloned exploit from GitHub
  5. Compiled exploit using GCC
  6. Executed exploit binary
  7. Gained root shell

💥 Result

Privilege escalation successfully achieved:

whoami
root

⚠️ Vulnerability Details

  • CVE ID: CVE-2021-3156
  • Affected Component: sudo
  • Type: Heap-Based Buffer Overflow
  • Impact: Privilege Escalation

🔐 Security Impact

  • Full system compromise
  • Arbitrary command execution
  • Unauthorized access to sensitive files
  • Persistent malware installation

🧪 Lab Environment

  • Platform: VirtualBox
  • OS: Ubuntu 20.04
  • Tools:
    • Git
    • GCC
    • Linux Terminal

🚀 Exploitation Steps (High-Level)

  1. Verify vulnerable sudo version
  2. Compile exploit code
  3. Execute exploit
  4. Gain root shell

⚠️ Detailed exploit steps are documented in the PDF report.


🛡️ Mitigation

  • Update sudo to 1.9.5p2 or later
  • Apply regular system patches
  • Restrict sudo access
  • Monitor privilege escalation attempts

📚 References

  • MITRE CVE Database
  • Exploit-DB
  • GTFOBins
  • PayloadsAllTheThings

⚡ Disclaimer

This project is created for educational purposes only.

All testing was conducted in a controlled lab environment.
Do not attempt this on systems without proper authorization.


Download Tool

Most Popular

View all →

Discover the most used tools by our community.

  • 1

    OsintHunter

    letox4/osinthunter

    🎯 The ultimate OSINT toolkit: investigation graph, confidence scoring, alias families, map, timeline and reports. 49 modules, 400+ sites, no API keys required.

    933
  • 2

    ghostlock-app

    yukonga/ghostlock-app

    GhostLock One-Tap Execution App (CVE-2026-43499)

    551
  • 3

    redforge

    cybersecurity91/redforge

    Browser-side red team toolkit with 102 offline tools for recon, payload generation, credential attacks, crypto, encoding and engagement reporting.

    354
  • 4

    ARTEX

    baarai/artex

    LLM multi-agent autonomous penetration testing platform with planner/worker agents, asset and exploration graphs, MITM traffic recording, and vulnerability retesting.

    351
  • 5

    looking-glass

    anonghosty/looking-glass

    CSIRT platform that ingests Shadowserver reports into MongoDB and replays them as interactive maps, analysis, findings, advisories and executive dashboards.

    332
  • 6

    CyberStrikeAI

    ed1s0nz/cyberstrikeai

    The system of action for AI-native cybersecurity—where intent becomes governed execution, evidence becomes operational memory, and every operation improves the next.

    289

Explore all tools

Browse our collection of tools

View all tools →