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-4034-mock β€” Safe, controlled mock system simulating CVE-2021-4034 (PwnKit) with out-of-bounds read/write, environment variable injection, and kernel defense detection for educational exploitation practice. | Kitploit
Tools/GitHubGitHub/leemyunglyul/cve-2021-4034-mock
Privilege EscalationVulnerability AnalysisExploitationLearning & EducationBinary ExploitationLabs & Practice
GitHubleemyunglyul/cve-2021-4034-mock

cve-2021-4034-mock

Safe, controlled mock system simulating CVE-2021-4034 (PwnKit) with out-of-bounds read/write, environment variable injection, and kernel defense detection for educational exploitation practice.

Share
View Repository
255 months agoNot yet reviewed

CVE-2021-4034 (PwnKit) Mock Vulnerability System

This project is a mock system that reproduces the core operating principles of CVE-2021-4034 (Out-of-Bounds Read/Write) vulnerability in the Linux pkexec daemon. Without actual SUID privilege escalation, it safely simulates the mechanism of environment variable memory region overrun and malicious payload injection within a controlled environment.

In particular, this mock system detects the defense mechanism of modern Linux kernels (which forces insertion of an empty string when an empty array is passed, effectively making argc=1) and adjusts offsets accordingly, successfully emulating the vulnerable memory environment of the past.

πŸ“‚ Project Structure

cve-2021-4034-mock/
β”œβ”€β”€ README.md                # Project description and execution guide
β”œβ”€β”€ src/
β”‚   β”œβ”€β”€ mock_pkexec.c        # Target daemon source with missing argument (argc) validation
β”‚   └── exploit.c            # Attacker source that delivers exploit payload via execve
└── bin/                     # Compiled binary storage path (created at build time)

πŸš€ Build Instructions

Navigate to the project root directory in the terminal and compile the source code by entering the following commands one line at a time in order.

# 1. Create the bin folder for storing executables
mkdir -p bin

# 2. Compile the target program (mock system)
gcc -Wall -Wextra -o bin/mock_pkexec src/mock_pkexec.c

# 3. Compile the exploit script
gcc -Wall -Wextra -o bin/exploit src/exploit.c

If compilation succeeds, the mock_pkexec and exploit executables will be created inside the bin/ folder.

πŸ’» Execution and Demonstration

1. Normal Execution

When executed with properly passed arguments, it demonstrates that the program either fails the privilege check due to defense logic or exits safely.

./bin/mock_pkexec test_argument
  • Result: The memory map is printed normally, and the program exits with an [OK] message.

2. Exploit Demonstration (Triggering Vulnerabilities)

Run the exploit script to forcefully pass an argc=0 payload (NULL array) and trigger the vulnerability.

./bin/exploit
  • Detailed Result Analysis:
  1. Kernel Defense Mechanism Detection: The mock system detects that modern OS kernels forcibly set argc to 1 and dynamically corrects the memory reference index.
  2. Out-of-Bounds (OOB) Occurrence: Due to missing index validation, the system overflows the argv array boundary and encroaches on the adjacent envp region.
  3. Environment Variable Injection: Restricted security environment variables (GCONV_PATH) are successfully overwritten in system memory, and a red [FATAL] ENVIRONMENT CORRUPTION DETECTED! warning is displayed.

🧹 Clean up

After testing, use the following command to delete the compiled binary files.

rm -rf bin/
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.

    968
  • 2

    ghostlock-app

    yukonga/ghostlock-app

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

    556
  • 3

    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.

    347
  • 4

    redforge

    cybersecurity91/redforge

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

    346
  • 5

    ARTEX

    baarai/artex

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

    319
  • 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.

    297

Explore all tools

Browse our collection of tools

View all tools β†’