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
CVE-2021-4034-PwnKit- — Este repositorio muestra cómo explotar la vulnerabilidad CVE-2021-4034. | Kitploit
Tools/GitHubGitHub/igonzalez357/cve-2021-4034-pwnkit-
Privilege EscalationVulnerability AnalysisExploitationPenetration TestingLearning & EducationBinary Exploitation
GitHubigonzalez357/cve-2021-4034-pwnkit-

CVE-2021-4034-PwnKit-

Este repositorio muestra cómo explotar la vulnerabilidad CVE-2021-4034.

View Repository
11 year agoNot yet reviewed

Most Popular

View all →

Discover the most used tools by our community.

Explore all tools

Browse our collection of tools

View all tools →
Share

CVE-2021-4034 (PwnKit) - Analysis and Exploitation

This repository contains the source code to demonstrate the exploitation of the CVE-2021-4034 vulnerability, also known as PwnKit, discovered in pkexec (part of the Polkit package). This flaw allows local privilege escalation to root through the use of malicious environment variables.


⚠️ Warning

This code is provided solely for educational and research purposes. It should not be used on production systems or without explicit authorization. Misuse may be illegal and violates the author's terms of use.


🧠 Technical Description

The vulnerability occurs when pkexec is executed without arguments, i.e., argc == 0. In this case, pkexec attempts to access argv[1] without checking that argv[0] exists, causing it to read from envp[0]. This allows the attacker to:

  • Read and overwrite environment variables such as GCONV_PATH.
  • Force the loading of an arbitrary .so library to execute code as root.

The exploit takes advantage of this condition to load a malicious library that opens a shell as the root user.


📁 Repository Files

  • cve-2021-4034.c: Source code of the exploit that invokes pkexec with argv[] = {NULL} and modified environment variables.
  • pwnkit.c: Source code of the malicious library that opens a shell as root.

🛠️ Compilation

root@kitploit:~
gcc -Wall -o cve-2021-4034 cve-2021-4034.c
gcc -Wall -shared -fPIC -o pwnkit.so pwnkit.c

🧪 Usage Instructions (Environment Preparation and Execution)

root@kitploit:~
mkdir GCONV_PATH=.
echo 'module UTF-8// PWNKIT// pwnkit 1' > gconv-modules
cp $(which true) GCONV_PATH=./pwnkit.so:.

./cve-2021-4034
Download Tool