CATSploit:基于CATS的自动化渗透测试执行工具

发表于:2024-4-28 09:17

字体: | 上一篇 | 下一篇 | 我要投稿

 作者:Alpha_h4ck    来源:FreeBuf

  关于CATSploit
  CATSploit是一款基于CATS的自动化渗透测试执行工具,该工具基于网络攻击技术评分(CATS)方法实现其功能,可以在无需渗透测试人员操作的情况下,自动对目标应用执行安全渗透测试。
  在执行渗透测试的过程中,广大安全研究人员首先需要针对目标系统的特征选择合适的测试技术,而CATSploit能够使用扫描工具收集目标系统的各种信息,其中包括操作系统、开放端口和软件版本等,并计算目标系统的各种安全评分。通过分析和选择适当的测试向量,CATSploit能够帮助我们在不具备专业渗透测试技术的情况下选择最合适的方法对目标系统执行自动化渗透测试。
  工具运行机制
  CATSploit能够按照下列操作序列自动执行渗透测试任务:
  1、信息收集和输入之前收集的信息:首先,该工具会收集目标系统的相关信息。CATSploit不仅支持使用nmap和OpenVAS来收集目标系统的信息,还支持输入预先收集的目标系统信息;
  2、计算渗透测试技术得分值:使用前一阶段获得的信息和渗透测试技术数据库,计算每种渗透测试技术的捕获性(eVc)和可探测性(eVd)评估值。对于每个目标设备,计算每个渗透测试技术的值;
  3、渗透测试技术选择:通过使用之前的评分并根据预定义的策略选择渗透测试技术并创建渗透测试场景;
  4、渗透测试执行:CATSploit可以根据前一阶段构建的渗透测试场景执行渗透测试技术。除此之外,CATSploit还会使用Metasploit框架和Metasploit API来执行实际的渗透测试;
  工具要求
  Kali Linux 2023.2a
  Python
  工具安装
  Kali Linux发行版默认会安装好Metasploit、Nmap、OpenVAS和Python环境。
  广大研究人员可以直接使用下列命令将该项目源码克隆至本地:
  $ git clone https://github.com/catsploit/catsploit.git
  然后切换到项目目录中,配置好工具帮助组件,并执行工具安装脚本即可:
  $ cd catsploit
  $ git clone https://github.com/catsploit/cats-helper.git
  $ sudo ./setup.sh
  工具配置
  CATSploit需要进行服务器和客户端配置,服务器会在启动时读取JSON配置文件config.json,我们需要根据实际情况修改相关数据:
  DBMS
  dbname: CATSploit的数据库名称
  user: PostgreSQL的用户名
  password: PostgreSQL的密码
  host: 如果你的数据库托管在远程主机,则指定远程主机的IP地址
  SCENARIO
  generator.maxscenarios: 需要计算的最大渗透测试场景数量 (*)
  ATACKPF
  msfpassword: MSFRPCD的密码
  openvas.user: PostgreSQL的用户名
  openvas.password: PostgreSQL的密码
  openvas.maxhosts: 同时测试的主机数最大数量 (*)
  openvas.maxchecks: 同时测试的条目数最大数量 (*)
  ATTACKDB
  attack_db_dir: 存储AtackSteps 的文件夹路径
  其中(*)标记的参数需要根据研究人员设备情况调整。
  工具使用
  下列命令可启动CATSploit服务器:
  $ python cats_server.py -c [CONFIG_FILE]
  接下来,打开另一个命令行终端,开启客户端程序,并初始化与服务器端的连接:
  $ python catsploit.py -s [SOCKET_PATH]
  成功连接服务器后,初始化工具,会话将会启动:
  _________  ___________       __      _ __
    / ____/   |/_  __/ ___/____  / /___  (_) /_
   / /   / /| | / /  \__ \/ __ \/ / __ \/ / __/
  / /___/ ___ |/ /  ___/ / /_/ / / /_/ / / /_
  \____/_/  |_/_/  /____/ .___/_/\____/_/\__/
                       /_/
   
  [*] Connecting to cats-server
  [*] Done.
  [*] Initializing server
  [*] Done.
  catsploit>
  客户端可以执行多种命令,每一个命令都可以使用-h选项来查看对应的帮助信息:
  usage: [-h] {host,scenario,scan,plan,attack,post,reset,help,exit} ...
   
  positional arguments:
    {host,scenario,scan,plan,attack,post,reset,help,exit}
   
  options:
    -h, --help       显示工具帮助信息和退出
  下面给出的是该工具的常用命令参数信息:
  host list:
   show information about the hosts
   usage:  host list [-h]
   options:
    -h, --help       显示命令帮助信息和退出
   
  host detail:
   show more information about one host
   usage:  host detail [-h] host_id
   positional arguments:
    host_id          要查看信息的主机ID
   options:
    -h, --help       显示命令帮助信息和退出
   
  scenario list:
   show information about the scenarios
   usage:  scenario list [-h]
   options:
    -h, --help       显示命令帮助信息和退出
   
  scenario detail:
   show more information about one scenario
   usage:  scenario detail [-h] scenario_id
   positional arguments:
    scenario_id      要查看信息的场景ID
   options:
    -h, --help       显示命令帮助信息和退出
   
  scan:
   run network-scan and security-scan
   usage:  scan [-h] [--port PORT] target_host [target_host ...]
   positional arguments:
    target_host      要扫描的IP地址
   options:
    -h, --help       显示命令帮助信息和退出
    --port PORT      要扫描的端口
   
  plan:
   planning attack scenarios
   usage:  plan [-h] src_host_id dst_host_id
   positional arguments:
    src_host_id      源主机
    dst_host_id      目标主机
   options:
    -h, --help       显示命令帮助信息和退出
   
  attack:
   execute attack scenario
   usage:  attack [-h] scenario_id
   positional arguments:
    scenario_id      需要执行的渗透测试场景ID
   
   options:
    -h, --help       显示命令帮助信息和退出
   
  post find-secret:
   find confidential information files that can be performed on the pwned host
   usage:  post find-secret [-h] host_id
   positional arguments:
    host_id          需要寻找凭证信息的主机ID
   options:
    -h, --help       显示命令帮助信息和退出
   
  reset:
   reset data on the server
   usage:  reset [-h] {system} ...
   positional arguments:
    {system}         重置系统
  options:
    -h, --help  显示命令帮助信息和退出
   
  exit:
    exit CATSploit
    usage:  exit [-h]
    options:
     -h, --help  显示命令帮助信息和退出
  工具使用样例
  在下面的演示样例中,我们将使用CATSploit扫描目标网络,并计划渗透测试策略和场景,最终执行渗透测试:
  catsploit> scan 192.168.0.0/24
  Network Scanning ... 100%
  [*] Total 2 hosts were discovered.
  Vulnerability Scanning ... 100%
  [*] Total 14 vulnerabilities were discovered.
  catsploit> host list
  ┏━━━━━━━━━━┳━━━━━━━━━━━━━━━━┳━━━━━━━━━━┳━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┳━━━━━━━┓
  ┃ hostID   ┃ IP             ┃ Hostname ┃ Platform                         ┃ Pwned ┃
  ┡━━━━━━━━━━╇━━━━━━━━━━━━━━━━╇━━━━━━━━━━╇━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━╇━━━━━━━┩
  │ attacker │ 0.0.0.0        │ kali     │ kali 2022.4                      │ True  │
  │ h_exbiy6 │ 192.168.0.10   │          │ Linux 3.10 - 4.11                │ False │
  │ h_nhqyfq │ 192.168.0.20   │          │ Microsoft Windows 7 SP1          │ False │
  └──────────┴────────────────┴──────────┴──────────────────────────────────┴───────┘
   
   
  catsploit> host detail h_exbiy6
  ┏━━━━━━━━━━┳━━━━━━━━━━━━━━┳━━━━━━━━━━┳━━━━━━━━━━━━━━┳━━━━━━━┓
  ┃ hostID   ┃ IP           ┃ Hostname ┃ Platform     ┃ Pwned ┃
  ┡━━━━━━━━━━╇━━━━━━━━━━━━━━╇━━━━━━━━━━╇━━━━━━━━━━━━━━╇━━━━━━━┩
  │ h_exbiy6 │ 192.168.0.10 │ ubuntu   │ ubuntu 14.04 │ False │
  └──────────┴──────────────┴──────────┴──────────────┴───────┘
   
  [IP address]
  ┏━━━━━━━━━━━━━━┳━━━━━━━━━━┳━━━━━━┳━━━━━━━━━━━━┓
  ┃ ipv4         ┃ ipv4mask ┃ ipv6 ┃ ipv6prefix ┃
  ┡━━━━━━━━━━━━━━╇━━━━━━━━━━╇━━━━━━╇━━━━━━━━━━━━┩
  │ 192.168.0.10 │          │      │            │
  └──────────────┴──────────┴──────┴────────────┘
   
  [Open ports]
  ┏━━━━━━━━━━━━━━┳━━━━━━━┳━━━━━━┳━━━━━━━━━━━━━┳━━━━━━━━━━━━━━┳━━━━━━━━━━━━━━━━━━━━━━━━━━━━┓
  ┃ ip           ┃ proto ┃ port ┃ service     ┃ product      ┃ version                    ┃
  ┡━━━━━━━━━━━━━━╇━━━━━━━╇━━━━━━╇━━━━━━━━━━━━━╇━━━━━━━━━━━━━━╇━━━━━━━━━━━━━━━━━━━━━━━━━━━━┩
  │ 192.168.0.10 │ tcp   │ 21   │ ftp         │ ProFTPD      │ 1.3.5                      │
  │ 192.168.0.10 │ tcp   │ 22   │ ssh         │ OpenSSH      │ 6.6.1p1 Ubuntu 2ubuntu2.10 │
  │ 192.168.0.10 │ tcp   │ 80   │ http        │ Apache httpd │ 2.4.7                      │
  │ 192.168.0.10 │ tcp   │ 445  │ netbios-ssn │ Samba smbd   │ 3.X - 4.X                  │
  │ 192.168.0.10 │ tcp   │ 631  │ ipp         │ CUPS         │ 1.7                        │
  └──────────────┴───────┴──────┴─────────────┴──────────────┴────────────────────────────┘
   
  [Vulnerabilities]
  ┏━━━━━━━━━━━━━━┳━━━━━━━┳━━━━━━┳━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┳━━━━━━━━━━━━━━━━┓
  ┃ ip           ┃ proto ┃ port ┃ vuln_name                                                           ┃ cve            ┃
  ┡━━━━━━━━━━━━━━╇━━━━━━━╇━━━━━━╇━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━╇━━━━━━━━━━━━━━━━┩
  │ 192.168.0.10 │ tcp   │ 0    │ TCP Timestamps Information Disclosure                               │ N/A            │
  │ 192.168.0.10 │ tcp   │ 21   │ FTP Unencrypted Cleartext Login                                     │ N/A            │
  │ 192.168.0.10 │ tcp   │ 22   │ Weak MAC Algorithm(s) Supported (SSH)                               │ N/A            │
  │ 192.168.0.10 │ tcp   │ 22   │ Weak Encryption Algorithm(s) Supported (SSH)                        │ N/A            │
  │ 192.168.0.10 │ tcp   │ 22   │ Weak Host Key Algorithm(s) (SSH)                                    │ N/A            │
  │ 192.168.0.10 │ tcp   │ 22   │ Weak Key Exchange (KEX) Algorithm(s) Supported (SSH)                │ N/A            │
  │ 192.168.0.10 │ tcp   │ 80   │ Test HTTP dangerous methods                                         │ N/A            │
  │ 192.168.0.10 │ tcp   │ 80   │ Drupal Core SQLi Vulnerability (SA-CORE-2014-005) - Active Check    │ CVE-2014-3704  │
  │ 192.168.0.10 │ tcp   │ 80   │ Drupal Coder RCE Vulnerability (SA-CONTRIB-2016-039) - Active Check │ N/A            │
  │ 192.168.0.10 │ tcp   │ 80   │ Sensitive File Disclosure (HTTP)                                    │ N/A            │
  │ 192.168.0.10 │ tcp   │ 80   │ Unprotected Web App / Device Installers (HTTP)                      │ N/A            │
  │ 192.168.0.10 │ tcp   │ 80   │ Cleartext Transmission of Sensitive Information via HTTP            │ N/A            │
  │ 192.168.0.10 │ tcp   │ 80   │ jQuery < 1.9.0 XSS Vulnerability                                    │ CVE-2012-6708  │
  │ 192.168.0.10 │ tcp   │ 80   │ jQuery < 1.6.3 XSS Vulnerability                                    │ CVE-2011-4969  │
  │ 192.168.0.10 │ tcp   │ 80   │ Drupal 7.0 Information Disclosure Vulnerability - Active Check      │ CVE-2011-3730  │
  │ 192.168.0.10 │ tcp   │ 631  │ SSL/TLS: Report Vulnerable Cipher Suites for HTTPS                  │ CVE-2016-2183  │
  │ 192.168.0.10 │ tcp   │ 631  │ SSL/TLS: Report Vulnerable Cipher Suites for HTTPS                  │ CVE-2016-6329  │
  │ 192.168.0.10 │ tcp   │ 631  │ SSL/TLS: Report Vulnerable Cipher Suites for HTTPS                  │ CVE-2020-12872 │
  │ 192.168.0.10 │ tcp   │ 631  │ SSL/TLS: Deprecated TLSv1.0 and TLSv1.1 Protocol Detection          │ CVE-2011-3389  │
  │ 192.168.0.10 │ tcp   │ 631  │ SSL/TLS: Deprecated TLSv1.0 and TLSv1.1 Protocol Detection          │ CVE-2015-0204  │
  └──────────────┴───────┴──────┴─────────────────────────────────────────────────────────────────────┴────────────────┘
   
  [Users]
  ┏━━━━━━━━━━━┳━━━━━━━┓
  ┃ user name ┃ group ┃
  ┡━━━━━━━━━━━╇━━━━━━━┩
  └───────────┴───────┘
   
   
  catsploit> plan attacker h_exbiy6
  Planning attack scenario...100%
  [*] Done. 15 scenarios was planned.
  [*] To check each scenario, try 'scenario list' and/or 'scenario detail'.
  catsploit> scenario list
  ┏━━━━━━━━━━━━━┳━━━━━━━━━━━━━┳━━━━━━━━━━━━━━━━┳━━━━━━━┳━━━━━━━┳━━━━━━━┳━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┓
  ┃ scenario id ┃ src host ip ┃ target host ip ┃ eVc   ┃ eVd   ┃ steps ┃ first attack step             ┃
  ┡━━━━━━━━━━━━━╇━━━━━━━━━━━━━╇━━━━━━━━━━━━━━━━╇━━━━━━━╇━━━━━━━╇━━━━━━━╇━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┩
  │ 3d3ivc      │ 0.0.0.0     │ 192.168.0.10   │ 1.0   │ 32.0  │ 1     │ exploit/multi/http/jenkins_s… │
  │ 5gnsvh      │ 0.0.0.0     │ 192.168.0.10   │ 1.0   │ 53.76 │ 2     │ exploit/multi/http/jenkins_s… │
  │ 6nlxyc      │ 0.0.0.0     │ 192.168.0.10   │ 0.0   │ 48.32 │ 2     │ exploit/multi/http/jenkins_s… │
  │ 8jos4z      │ 0.0.0.0     │ 192.168.0.10   │ 0.7   │ 72.8  │ 2     │ exploit/multi/http/jenkins_s… │
  │ 8kmmts      │ 0.0.0.0     │ 192.168.0.10   │ 0.0   │ 32.0  │ 1     │ exploit/multi/elasticsearch/… │
  │ agjmma      │ 0.0.0.0     │ 192.168.0.10   │ 0.0   │ 24.0  │ 1     │ exploit/windows/http/managee… │
  │ joglhf      │ 0.0.0.0     │ 192.168.0.10   │ 70.0  │ 60.0  │ 1     │ auxiliary/scanner/ssh/ssh_lo… │
  │ rmgrof      │ 0.0.0.0     │ 192.168.0.10   │ 100.0 │ 32.0  │ 1     │ exploit/multi/http/drupal_dr… │
  │ xuowzk      │ 0.0.0.0     │ 192.168.0.10   │ 0.0   │ 24.0  │ 1     │ exploit/multi/http/struts_dm… │
  │ yttv51      │ 0.0.0.0     │ 192.168.0.10   │ 0.01  │ 53.76 │ 2     │ exploit/multi/http/jenkins_s… │
  │ znv76x      │ 0.0.0.0     │ 192.168.0.10   │ 0.01  │ 53.76 │ 2     │ exploit/multi/http/jenkins_s… │
  └─────────────┴─────────────┴────────────────┴───────┴───────┴───────┴───────────────────────────────┘
   
  catsploit> scenario detail rmgrof
  ┏━━━━━━━━━━━━━┳━━━━━━━━━━━━━━━━┳━━━━━━━┳━━━━━━┓
  ┃ src host ip ┃ target host ip ┃ eVc   ┃ eVd  ┃
  ┡━━━━━━━━━━━━━╇━━━━━━━━━━━━━━━━╇━━━━━━━╇━━━━━━┩
  │ 0.0.0.0     │ 192.168.0.10   │ 100.0 │ 32.0 │
  └─────────────┴────────────────┴───────┴──────┘
   
  [Steps]
  ┏━━━┳━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┳━━━━━━━━━━━━━━━━━━━━━━━┓
  ┃ # ┃ step                                  ┃ params                ┃
  ┡━━━╇━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━╇━━━━━━━━━━━━━━━━━━━━━━━┩
  │ 1 │ exploit/multi/http/drupal_drupageddon │ RHOSTS: 192.168.0.10  │
  │   │                                       │ LHOST: 192.168.10.100 │
  └───┴───────────────────────────────────────┴───────────────────────┘
   
   
  catsploit> attack rmgrof
  > ~
  > ~
  > Metasploit Console Log
  > ~
  > ~
  [+] Attack scenario succeeded!
   
   
  catsploit> exit
  Bye.
  本文内容不用于商业目的,如涉及知识产权问题,请权利人联系51Testing小编(021-64471599-8017),我们将立即处理
《2023软件测试行业现状调查报告》独家发布~

关注51Testing

联系我们

快捷面板 站点地图 联系我们 广告服务 关于我们 站长统计 发展历程

法律顾问:上海兰迪律师事务所 项棋律师
版权所有 上海博为峰软件技术股份有限公司 Copyright©51testing.com 2003-2024
投诉及意见反馈:webmaster@51testing.com; 业务联系:service@51testing.com 021-64471599-8017

沪ICP备05003035号

沪公网安备 31010102002173号