Deep Exploit:使用机器学习的全自动渗透测试工具

Deep Exploit是与Metasploit链接的全自动渗透工具。

Deep Exploit有两种开发模式:

  • 智能模式

Deep Exploit可以识别目标服务器上所有打开的端口的状态,并根据过去的经验(训练结果)精确地执行漏洞利用。

  • 蛮力模式

Deep Exploit利用与用户指定的产品名称和端口号相对应的“漏洞利用模块”,“目标”和“有效负载”的所有组合来执行漏洞利用。

Deep Exploit的主要功能如下:

  • 有效执行漏洞利用

如果“智能模式”,Deep Exploit可以在精确定位点执行攻击(至少1次尝试)。

如果“暴力破解模式”,Deep Exploit可以根据用户指定的产品名称和端口号彻底执行漏洞利用程序。

  • 深入渗透

如果Deep Exploit成功利用目标服务器,它会进一步对其他内部服务器执行利用。

  • 操作非常简单

您唯一的操作是输入一个命令。这很容易!

  • 自学

Deep Exploit不需要“学习数据”。

Deep Exploit可以学习如何使用自己的方法(使用强化学习)。

  • 学习时间非常快

Deep Exploit使用多代理的分布式学习。

所以,我们采用了一种名为A3C的高级机器学习模型

目前Deep Exploit的版本是测试版。

但是,它可以自动执行以下操作:

  • 情报收集
  • 威胁建模
  • 漏洞分析
  • 开发
  • 后期开发
  • 报告

系统组成

system_component

处理流程

智能模式

intelligence_mode

第1步 端口扫描目标服务器

Deep Exploit使用Nmap执行端口扫描以收集目标服务器的信息。

之后,Deep Exploit通过RPC API执行两个Metasploit的命令(主机和服务)。

  • ex) result of hosts command.

Hosts
=====

address mac name os_name os_flavor os_sp purpose info comments
——- — —- ——- ——— —– ——- —- ——–
192.168.220.145 00:0c:29:16:3a:ce Linux 2.6.X server

Deep Exploit从主机命令的结果中获取OS类型。 在上面的例子中,Deep Exploit将Linux作为操作系统类型。

  • ex) result of services command.

Services
========

host port proto info
—- —- —– —-
192.168.220.145 21 tcp vsftpd 2.3.4
192.168.220.145 22 tcp OpenSSH 4.7p1 Debian 8ubuntu1 protocol 2.0
192.168.220.145 23 tcp Linux telnetd
192.168.220.145 25 tcp Postfix smtpd
192.168.220.145 53 tcp ISC BIND 9.4.2

…snip…

192.168.220.145 5900 tcp VNC protocol 3.3
192.168.220.145 6000 tcp access denied
192.168.220.145 6667 tcp UnrealIRCd
192.168.220.145 8009 tcp Apache Jserv Protocol v1.3
192.168.220.145 8180 tcp Apache Tomcat/Coyote JSP engine 1.1

RHOSTS => 192.168.220.145

Deep Exploit从端口扫描的结果中获取端口号,协议类型,产品名称,产品版本。

在上面的例子中,Deep Exploit的端口号为21,协议为tcp,产品为vsftpd,版本为2.3.4

第2步 利用Metasploit进行培训

overview_deepexploit

Deep Exploit使用名为A3C的高级机器学习模型学习如何开发方法。

因此,Deep Exploit使用易受攻击的服务器,例如metasploitable2,owaspbwa进行学习。

第3步 利用Metasploit进行测试

第4步 利用后

第5步 生成报告

Deep Exploit生成汇总漏洞的报告。报告的样式是html。

蛮力模式

brute_force_mode

用法

步骤0 初始化Metasploit DB

首先,你使用msfdb命令初始化metasploit db(postgreSQL)。

root@kali:~# msfdb init

步骤1 启动Metasploit框架

您可以在安装Metasploit Framework的远程服务器(如Kali Linux)上启动Metasploit。

root@kali:~# msfconsole
______________________________________________________________________________
| |
| METASPLOIT CYBER MISSILE COMMAND V4 |
|______________________________________________________________________________|
\\ / /
\\ . / / x
\\ / /
\\ / + /
\\ + / /
* / /
/ . /
X / / X
/ ###
/ # % #
/ ###
. /
. / . * .
/
*
+ *

^
#### __ __ __ ####### __ __ __ ####
#### / \\ / \\ / \\ ########### / \\ / \\ / \\ ####
################################################################################
################################################################################
# WAVE 4 ######## SCORE 31337 ################################## HIGH FFFFFFFF #
################################################################################
https://metasploit.com

=[ metasploit v4.16.15-dev ]
+ — –=[ 1699 exploits – 968 auxiliary – 299 post ]
+ — –=[ 503 payloads – 40 encoders – 10 nops ]
+ — –=[ Free Metasploit Pro trial: http://r-7.co/trymsp ]

msf >

步骤2 启动RPC服务器

启动Metasploit的RPC服务器。

msf> load msgrpc ServerHost=192.168.220.144 ServerPort=55553 User=test Pass=test1234
[*] MSGRPC Service: 192.168.220.144:55553
[*] MSGRPC Username: test
[*] MSGRPC Password: test1234
[*] Successfully loaded plugin: msgrpc

msgrpc 选项 描述
ServerHost IP address of your server that launched Metasploit. Above example is 192.168.220.144.
ServerPort Any port number of your server that launched Metasploit. Above example is 55553.
User Any user name using authentication (default => msf). Above example is test.
Pass Any password using authentication (default => random string). Above example is test1234.

步骤3 编辑配置文件

您必须在config.ini中更改以下值

…snip…

[Common]
server_host : 192.168.220.144
server_port : 55553
msgrpc_user : test
msgrpc_pass : test1234

…snip…

[Metasploit]
lhost : 192.168.220.144

config description
server_host IP address of your server that launched Metasploit. Your setting value ServerHost in Step2.
server_port Any port number of your server that launched Metasploit. Your setting value ServerPort in Step2.
msgrpc_user Metasploit’s user name using authentication. Your setting value User in Step2.
msgrpc_pass Metasploit’s password using authentication. Your setting value Pass in Step2.
lhost IP address of your server that launched Metasploit. Your setting value ServerHost in Step2.

智能模式

步骤4 训练深度利用

您在客户端计算机上使用培训模式执行Deep Exploit。

local@client:~$ python DeepExploit.py -t 192.168.184.132 -m train

command options description
-t, –target IP address of training vulnerable host such as Metasploitable2.
-m, –mode Execution mode “train”.

步骤5 使用训练有素的Deep Exploit进行测试

您在客户端计算机上使用测试模式执行Deep Exploit。

local@client:~$ python DeepExploit.py -t 192.168.184.129 -m test

command options description
-t, –target IP address of test target host.
-m, –mode Execution mode “test”.

Step.6 检查扫描报告

请使用任何网页浏览器检查扫描报告。

local@client:~$ firefox “Deep Exploit root path”/report/DeepExploit_report.html

来源:https://github.com/13o-bbr-bbq/machine_learning_security/tree/master/DeepExploit#step6-check-scan-report

上一篇:深入探索Cobalt Strike的ExternalC2框架

下一篇:Spring Data Commons爆出远程代码执行漏洞