题目描述
Lets separate the script-kids from script-teenies.
Hint: The first impression is not always the right one!
If you need hints, call me on twitter: @0815R2d2 Have fun...
This works better with VirtualBox rather than VMware
This works better with VirtualBox rather than VMware.
环境下载
- 戳此进行环境下载
FUNBOX: NEXT LEVEL靶机搭建
- 将下载好的靶机环境,导入 VritualBox,设置为 Host-Only 模式
- 将 VMware 中桥接模式网卡设置为 VritualBox 的 Host-only
- 目标靶机的 IP 地址为:
192.168.56.113
- 攻击机的 IP 地址为:
192.168.56.102
![](https://pic.imgdb.cn/item/612873d244eaada739aa4697.png)
渗透测试
信息搜集
用 Nmap 扫描一下目标靶机的端口信息:
sudo nmap -sS -A -Pn 192.168.56.113
,发现开放了22、80
端口
![](https://pic.imgdb.cn/item/612873d244eaada739aa46ac.png)
用 dirb 扫描一下 80 端口 web 目录:
dirb http://192.168.56.113
![](https://pic.imgdb.cn/item/612873d244eaada739aa46b8.png)
漏洞挖掘
- 根据扫描结果访问
http://192.168.56.113/robots.txt
,没啥用处
![](https://pic.imgdb.cn/item/612873d244eaada739aa46c3.png)
- 由于扫描结果中存在
WordPress
,利用wpscan
进行扫描,发现两个用户
wpscan --url http://192.168.56.113/drupal/index.php --wp-content-dir=http://192.168.56.113/drupal/wp-content --enumerate u,p
![](https://pic.imgdb.cn/item/612877a644eaada739b2529c.png)
- 由于无法访问
wp-admin
,但是开放了 22 端口,尝试利用得到的两个用户名来爆破ssh
登录密码
hydra -l ben -P rockyou.txt -V 192.168.56.113 ssh
getshell
- 得到一组用户名和密码
ben:pookie
,利用该凭据连接 ssh
![](https://pic.imgdb.cn/item/6128778844eaada739b21258.png)
提权
- 注意到 ben 用户在 mail 组中,但是不能直接使用
![](https://pic.imgdb.cn/item/6128784d44eaada739b3cc88.png)
- 尝试连接到本地的 110 端口,用 ben 用户的信息凭据登录,发现三封邮件,在第三封邮件中发现了一组用户名和密码:
adam:qwedsayxc!
![](https://pic.imgdb.cn/item/6128796444eaada739b63bd3.png)
- 切换用户到
adam
,查看id
发现该用户在sudo
组中,查看sudo -l
![](https://pic.imgdb.cn/item/612879fc44eaada739b7920e.png)
- 可以通过
dd
命令来进行提权操作,参考链接
- 先使用 dd 命令将
/etc/passwd
复制到当前目录下
![](https://pic.imgdb.cn/item/61287dab44eaada739c00901.png)
- 由于
adam
用户没有修改权限,所以将其下载到本地
![](https://pic.imgdb.cn/item/61287dab44eaada739c00912.png)
- 生成一个以 root 为密码的密文,然后使用 root 身份进行修改
![](https://pic.imgdb.cn/item/61287dab44eaada739c00919.png)
- 将修改好的内容上传回去
![](https://pic.imgdb.cn/item/61287dab44eaada739c0092c.png)
- 再利用 dd 命令将
/etc/passwd
的内容替换成修改过后的内容
![](https://pic.imgdb.cn/item/61287dab44eaada739c00940.png)
- 切换到 root 用户,用 root 作为密码登录,成功拿到 root 权限
![](https://pic.imgdb.cn/item/61287e2744eaada739c12540.png)