Skip to content
KitploitKITPLOIT
उपकरणएक्सप्लॉइटब्लॉग
Log in
जमा करें
उपकरणएक्सप्लॉइटब्लॉग
जमा करें

हैकिंग, पेनटेस्ट और साइबर सुरक्षा उपकरण आपके सुरक्षा शस्त्रागार के लिए!

Kitploit हैकिंग, साइबर सुरक्षा और पेंटेस्टिंग टूल्स की एक निर्देशिका है। कमजोरियों को खोजने, सिस्टम का विश्लेषण करने, परीक्षण को स्वचालित करने और अपनी सुरक्षा को मजबूत करने के लिए नवीनतम प्रोजेक्ट अपडेट खोजें।

फ़ीडसंपर्कगोपनीयता© 2026 Kitploit

टूल निर्देशिका

श्रेणियाँ

सभी श्रेणियाँ देखें
Loading categories
CVE-2021-3156 — Proof-of-concept exploit for the sudo Baron Samedit heap overflow (CVE-2021-3156) that gains local root via an NSS service_user overwrite, with a static/musl launcher for older glibc targets. | Kitploit
उपकरण/GitHubGitHub/d4ytox/cve-2021-3156
Privilege EscalationVulnerability AnalysisExploitationShellcodeRed TeamingPayload Development
GitHubd4ytox/cve-2021-3156

CVE-2021-3156

Proof-of-concept exploit for the sudo Baron Samedit heap overflow (CVE-2021-3156) that gains local root via an NSS service_user overwrite, with a static/musl launcher for older glibc targets.

रिपॉजिटरी देखें
131 अक्टू॰ 2026अभी तक समीक्षित नहीं
साझा करें
वेबसाइट
अनुरोधित भाषा में सामग्री उपलब्ध नहीं है। अंग्रेज़ी संस्करण दिखाया जा रहा है।

CVE-2021-3156

Heap-based buffer overflow in sudo giving a root shell from an unprivileged local account.

When sudo runs in shell mode it unescapes backslashes in the command arguments, and the loop that does so runs past the end of a heap buffer when an argument ends in a single backslash. sudoedit -s reaches that code path, and the user does not have to appear in sudoers or know a password.

This proof of concept uses the struct service_user overwrite from section 2 of the Qualys advisory. The overflow rewrites the name of glibc's files NSS service, so nss_load_library() builds the path libnss_x/x.so.2 and hands it to dlopen. That library's constructor runs inside the still-privileged sudo process and execs a shell.

The sudo project lists 1.7.7 through 1.7.10p9, 1.8.2 through 1.8.31p2, and 1.9.0 through 1.9.5p1 as affected, fixed in 1.8.32 and 1.9.5p2. Qualys's advisory covers 1.8.2 and later in a default configuration.

Usage

make
./exploit

Run it from the directory holding libnss_x/. The path glibc builds has a slash in it, so dlopen resolves it against the working directory and nowhere else. Move the binary on its own and the lookup fails with no shell and no useful error.

sudoedit -s Y tells you whether a target is worth trying: a vulnerable sudo asks for a password, a patched one prints usage.

On Ubuntu 20.04, sudo apt install sudo=1.8.31-1ubuntu1 installs a vulnerable version for testing.

Building for a target with an older glibc

make links the launcher static, which is the reason this copy exists. Built dynamically on a current distribution it picks up __libc_start_main@GLIBC_2.34 and then refuses to start on anything older:

./exploit: /lib/x86_64-linux-gnu/libc.so.6: version `GLIBC_2.34' not found

Static linking is safe for this particular program because it only calls memset, strcat, strlen and execve. No NSS lookups, no dlopen, no name resolution, so the usual reasons to avoid static glibc do not apply. The launcher's libc has no bearing on the exploit either: its whole job is to assemble argv and envp and call execve, after which the process image belongs to sudoedit.

libnss_x/x.so.2 needs nothing done to it. -nostdlib already leaves it with no NEEDED entry and no symbol versions at all. The extra link flags in the Makefile only keep newer toolchain defaults out of the ELF, DT_RELR in particular, which needs glibc 2.36 to load.

make verify fails if either file picks up a version dependency again.

make docker is the alternative if you want a dynamic binary instead. It builds both files inside ubuntu:20.04, and the launcher that comes out asks for nothing newer than GLIBC_2.4.

A static glibc launcher is about 770 KB, which is a lot to push through a shell. musl gives the same thing in 13 KB:

docker run --rm -v "$PWD:/src" -w /src alpine:3.19 sh -c \
  'apk add --no-cache gcc musl-dev && gcc -O3 -static -o exploit.musl exploit.c'

Tested against

Built on Kali with glibc 2.42 and binutils 2.47.

The static and musl launchers were run under Ubuntu 20.04's glibc 2.31-0ubuntu9.17 in a container, with a harness in place of /usr/bin/sudoedit. Both start cleanly where the dynamic build dies on GLIBC_2.34, and both hand sudoedit an argv and envp byte-identical to the dynamic build's. That covers the loading problem this copy was made to fix and nothing beyond it. It is not a test against a vulnerable sudo.

Upstream reports testing on Ubuntu 20.04 against sudo 1.8.31.

Origin

Neither the vulnerability nor the proof of concept is mine.

The Qualys Research Team found the bug and published "Baron Samedit: Heap-based buffer overflow in Sudo (CVE-2021-3156)" on 26 January 2021:

  • https://www.qualys.com/2021/01/26/cve-2021-3156/baron-samedit-heap-based-overflow-sudo.txt
  • https://www.openwall.com/lists/oss-security/2021/01/26/3 (mirror)

The blog URL cited in the header of exploit.c now returns 403. The sudo project's own advisory is at https://www.sudo.ws/security/advisories/unescape_overflow/.

The proof of concept was published by GitHub user CptGibbon at https://github.com/CptGibbon/CVE-2021-3156. exploit.c names Max Kamper as its author.

exploit.c and shellcode.c are byte-identical to upstream commit 7726dd3633a7125e3327727038dd64d641fdbf7b of 3 February 2021 and are unchanged here. The Makefile is mine. I took the copy from https://github.com/mohinparamasivam/Sudo-1.8.31-Root-Exploit, a fork that carries no commits of its own.

Licence

The upstream repository states no licence, so nothing in exploit.c or shellcode.c is relicensed here and its author keeps all rights in it. The MIT grant in LICENSE covers the Makefile and this README. The author line stays in the header of exploit.c.

Legal

For authorised testing and research only. Running this against a system you do not own, or do not have written permission to test, is illegal in most places.

टूल डाउनलोड करें

संबंधित टूल

  • PEASS-ng

    PEASS - विशेषाधिकार वृद्धि के लिए अद्भुत स्क्रिप्ट्स सूट (रंगों के साथ)

  • PrivescCheck

    विंडोज के लिए विशेषाधिकार वृद्धि गणना स्क्रिप्ट

  • LinEnum

    स्क्रिप्टेड स्थानीय लिनक्स गणना और विशेषाधिकार वृद्धि जांच

सबसे लोकप्रिय

सभी देखें →

हमारे समुदाय द्वारा सबसे अधिक उपयोग किए जाने वाले उपकरण खोजें।

  • 1

    Callisto

    jetp1ane/callisto

    स्वचालित बाइनरी भेद्यता विश्लेषण उपकरण जो Ghidra के माध्यम से निष्पादन योग्य फ़ाइलों को डीकंपाइल करता है, Semgrep के साथ स्यूडो-सी कोड को स्कैन करता है, और गलत सकारात्मकता को कम करने के लिए GPT-3.5-Turbo का उपयोग करके निष्कर्षों को मान्य करता है।

    796
  • 2

    ghostlock-app

    yukonga/ghostlock-app

    # घोस्टलॉक वन-टैप निष्पादन ऐप (CVE-2026-43499)

    735
  • 3

    IMSIcatcher

    28zaaky/imsicatcher

    IMSI Catcher प्लेटफ़ॉर्म जो SMS को इंटरसेप्ट करने, संदेश इंजेक्ट करने और मोबाइल उपकरणों को ट्रैक करने के लिए एक रोगी GSM सेल तैनात करता है

    721
  • 4

    opencti

    opencti-platform/opencti

    खुला साइबर खतरा बुद्धिमत्ता प्लेटफॉर्म

    535
  • 5

    ARTEX

    baarai/artex

    प्लानर/वर्कर एजेंट, एसेट और एक्सप्लोरेशन ग्राफ़, MITM ट्रैफ़िक रिकॉर्डिंग, और भेद्यता पुनःपरीक्षण के साथ LLM मल्टी-एजेंट स्वायत्त पेनेट्रेशन टेस्टिंग प्लेटफ़ॉर्म।

    424
  • 6

    DFRoot

    a2333c/dfroot

    Samsung Galaxy S25 Ultra (SM-S938B) के लिए Android रूट टूल जो बूट पर KernelSU के माध्यम से स्वचालित रूप से रूट प्राप्त करने के लिए DirtyFrag CVE-2026-43284 और CVE-2026-43499 को चेन करता है।

    419

सभी उपकरण खोजें

हमारे उपकरणों का संग्रह ब्राउज़ करें

सभी उपकरण देखें →