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-Rust — Rust implementation of the CVE-2021-4034 polkit pkexec local privilege escalation exploit, with build instructions and detection considerations. | Kitploit
Tools/GitHubGitHub/deoxykev/cve-2021-4034-rust
Privilege EscalationExploit FrameworksExploitationRed TeamingPayload DevelopmentBinary Exploitation
GitHubdeoxykev/cve-2021-4034-rust

CVE-2021-4034-Rust

Rust implementation of the CVE-2021-4034 polkit pkexec local privilege escalation exploit, with build instructions and detection considerations.

View Repository
24 years 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-Rust

Linux LPE using polkit-1 written in Rust.

Build instructions

Install rust if you haven't already

root@kitploit:~
git clone https://github.com/deoxykev/CVE-2021-4034-Rust
cd CVE-2021-4034-Rust
rustup target add x86_64-unknown-linux-musl
cargo build --release

Vuln Check

root@kitploit:~
# check for pkexec
which pkexec || echo not vuln

# check suid permissions on pkexec
stat -c '%a' $(which pkexec) | grep -q 4755 || echo not vuln

# check patch date on pkexec
stat -c '%y' $(which pkexec)
# dates before 2022-01-12 may be unpatched & vulnerable

Opsec considerations

  • Writes exploit files to /dev/shm (ramdisk)
    • delete randomly generated directory afterwards
    • can be detected on file creation
    • shellcode is hardcoded, consider replacing with a polymorphic payload (ie: msfvenom output)
  • syscall to pkexec with null args can be detected
  • pkexec logs are visible in /var/log/auth.log
root@kitploit:~
pkexec[121401]: user: The value for the SHELL variable was not found the /etc/shells file [USER=root] [TTY=/dev/pts/8] [CWD=/dev/shm/YWdQYnE3TSNlwNKMXEwYcGRVmdYipb] [COMMAND=GCONV_PATH=./tSq82ptZaDiyXWZz0BOybdH9fINqCG PATH=GCONV_PATH=. CHARSET=mgELtKAB9sXo0a9KJk00NNO0wa4x0J SHELL=mgELtKAB9sXo0a9KJk00NNO0wa4x0J]

Sigma Rule Detection

  • https://github.com/SigmaHQ/sigma/blob/master/rules/linux/auditd/lnx_auditd_cve_2021_4034.yml

Credits

vuln disclosure - qualsys research team - https://blog.qualys.com/vulnerabilities-threat-research/2022/01/25/pwnkit-local-privilege-escalation-vulnerability-discovered-in-polkits-pkexec-cve-2021-4034 shellcode - @johkrupp - https://saarsec.rocks/2020/05/14/golf.so.html

Download Tool