Blocky — Exposed Plugin Credentials and Unrestricted Sudo
- Tools
- rustscan, feroxbuster, jadx, ssh, sudo
- Skill demonstrated
- Credential recovery from exposed application source and Linux privilege escalation through permissive sudo
- Tags
At a glance
Section titled “At a glance”| Field | Value |
|---|---|
| Difficulty | Easy |
| Target environment | Ubuntu Linux; Apache httpd 2.4.18 serving WordPress 4.8 |
| Starting position | Unauthenticated network access |
| Objective | Move from an exposed Java plugin’s hardcoded database credentials to SSH access through credential reuse, then escalate through an unrestricted sudo policy |
| Outcome | SSH access as <LAB_USER> and root command execution through the account’s unrestricted sudo policy |
Summary
Section titled “Summary”Blocky is an Easy Hack The Box Linux lab themed around a Minecraft server. Web content discovery exposes a non-standard /plugins directory holding Java plugin archives; decompiling the custom plugin reveals hardcoded database credentials, and those credentials authenticate to an exposed phpMyAdmin instance, disclosing the WordPress user account. The same password is reused for SSH, and the account holds an unrestricted sudo policy. Target addresses, hostnames, and credential values are replaced with role-based placeholders; command syntax is preserved.
Attack path: Exposed /plugins directory → decompiled BlockyCore.jar → hardcoded database credentials → phpMyAdmin account discovery → SSH through credential reuse → unrestricted sudo → root
Context and Objective
Section titled “Context and Objective”- Target: Ubuntu Linux host exposing FTP, SSH, HTTP, and a Minecraft service.
- Web application: Apache httpd 2.4.18 serving a WordPress 4.8 site.
- Starting position: unauthenticated network access.
- Objective: turn exposed plugin source into operating-system access, then determine the authenticated account’s privilege boundary.
- Constraints: activity was confined to the Hack The Box lab environment.
Approach and Evidence
Section titled “Approach and Evidence”1. Service Enumeration
Section titled “1. Service Enumeration”Observation: a full-port scan exposes four services, and the web application is the most useful entry point.
rustscan -a <TARGET_IP> --ulimit 5000 -- -Pn -sC -sV -oN <SCAN_OUTPUT>Truncated scan output:
21/tcp open ftp?22/tcp open ssh OpenSSH 7.2p2 Ubuntu 4ubuntu2.280/tcp open http Apache httpd 2.4.18|_http-title: BlockyCraft - Under Construction!|_http-generator: WordPress 4.825565/tcp open minecraft Minecraft 1.11.2Significance: the HTTP banner identifies a WordPress deployment, so content discovery is expected to expose application structure that the rendered site does not advertise; the SSH version confirms a Linux host.
Result: SSH, HTTP, and Minecraft are exposed, and the HTTP response identifies a WordPress 4.8 deployment served by Apache 2.4.18.
2. Web Content Discovery
Section titled “2. Web Content Discovery”Observation: content discovery against the WordPress site returns administrative and plugin paths.
feroxbuster --url http://<DOMAIN> --wordlist <WEB_CONTENT_WORDLIST> -nTruncated discovery output:
/wp-admin/phpmyadmin/pluginsThe /plugins directory contains Java archives:
BlockyCore.jargriefprevention-1.11.2-3.1.1.298.jarSignificance: /plugins is a non-standard, browsable path that exposes custom application artifacts, and Java archives can disclose implementation details not visible in browser-rendered content.
Result: a custom BlockyCore.jar plugin archive is reachable without authentication.
3. Plugin Decompilation and Credential Recovery
Section titled “3. Plugin Decompilation and Credential Recovery”Observation: decompiling the custom plugin exposes hardcoded database credentials in its source.
jadx <PLUGIN_ARCHIVE>this.sqlUser = "<DATABASE_USER>";this.sqlPass = "<DATABASE_PASSWORD>";Significance: Java archives are source-disclosable, so credentials embedded in a reachable plugin become readable with a standard decompiler.
Result: a database credential pair is recovered from the plugin source.
4. Database Access and Account Discovery
Section titled “4. Database Access and Account Discovery”Observation: the recovered database credential was used against the exposed phpMyAdmin instance; the source records that the login succeeded and exposed the WordPress database, including the wp_users table.
<DATABASE_USER> : <DATABASE_PASSWORD>wp_users:<LAB_USER>$P$<HASH_REDACTED>Significance: the database discloses the WordPress account name and confirms the database credential. The password hash was not needed because the password is reused by the system account.
Result: the WordPress account <LAB_USER> is identified, and its password hash is not required for the next step.
5. SSH Access through Credential Reuse
Section titled “5. SSH Access through Credential Reuse”Observation: the database credential is also the system account’s password, so the recovered secret crosses from the application to the operating system.
ssh <LAB_USER>@<TARGET_IP><LAB_USER>@<HOST>:~$Significance: a credential disclosed by application source gives direct host access because the database and operating-system accounts share the same secret.
Result: an authenticated SSH shell is obtained as <LAB_USER>.
6. Privilege Escalation through Unrestricted Sudo
Section titled “6. Privilege Escalation through Unrestricted Sudo”Observation: the authenticated account may run every command as every user.
sudo -lUser <LAB_USER> may run the following commands on <HOST>: (ALL : ALL) ALLAction:
sudo su -whoamirootSignificance: (ALL : ALL) ALL removes meaningful privilege separation, so the account can assume root directly through sudo.
Result: an administrative shell is established, and whoami returns root.
Challenges and Decisions
Section titled “Challenges and Decisions”No other obstacles or failed attempts affected this path.
Outcome
Section titled “Outcome”The evidence establishes an authenticated SSH session as <LAB_USER>, reached through a credential recovered from an exposed plugin archive and reused across the database and host, and a root context obtained through the account’s unrestricted sudo policy. The recovered password hash was not required for the path.
Lessons and Recommendations
Section titled “Lessons and Recommendations”Each finding pairs the observed root cause with its demonstrated impact and a prioritized action. These actions are recommendations; none was validated in the lab.
- Exposed plugin directory with embedded credentials.
/pluginswas reachable without authentication, and its Java archives contained hardcoded database credentials that yielded application and host access. Recommendation: keep build and development artifacts out of the web root, keep plugin directories non-browsable, and store secrets in a managed secret store instead of in source. Detection: alert on requests for archive files under the web root and scan deployed artifacts for credential patterns. - Credential reuse across trust boundaries. The same password authenticated to the database and the system account, so one source disclosure crossed from application to operating system. Recommendation: issue unique credentials per service and system account, and rotate any value exposed in source. Detection: alert on successful SSH authentication that reuses a known service credential or originates from an unexpected source.
- Unrestricted sudo policy.
(ALL : ALL) ALLlet the account run any command as any user, reducing privilege escalation to a single command. Recommendation: scopesudoersrules to specific commands and arguments under least privilege. Validation: reviewsudo -loutput and auditsudoersfor blanketALLgrants.
References
Section titled “References”- Hack The Box — Blocky (retired machine)
- RustScan (fast port scanner)
- feroxbuster (content discovery)
- jadx (Java and Dalvik decompiler)
- sudo (privilege delegation)