SUID,SUDO binary hijack
find the suid file
1 |
|
if it was in the list of GTFObins
https://gtfobins.github.io/
so excute command follow GTFObins,if it not in the list.
use follow ways
Sudo command/SUID binary without command path
sudo:
If the sudo permission is given to a single command without specifying the path: hacker10 ALL= (root) less you can exploit it by changing the PATH variable
1 |
|
suid:
using strings to check the suid file
1 |
|
in this binary file, it dont specify the command path,so we could inject the path
1 |
|
check the PATH
1 |
|
and move the bound reverse-shell into this path(/home/john) and name it chpasswd(remember add x to the file)
bound reverse-shell
1 |
|
and excute the suid binary file.
or we could add a suid bash file
1 |
|
1 |
|
if i meet new situation, i will update the article.
recommend blog or material
Hijacking Relative Paths in SUID Programs | by Nairuz Abulhul | R3d Buck3T | Medium