root@thehacksparrow:~/writeups$ SYSTEM ONLINE
root@sparrow:~/writeups$ cat intentions.md
// writeups

Intentions

1 Jul 2023 · 27 min read · root access
Intentions - maquina de Hack The Box

Executive summary — Intentions is an image gallery built on Laravel (PHP backend) with a single-page Vue frontend, and none of its steps rely on a public CVE: the whole chain is built by stringing together application-specific logic and design flaws. An administration JavaScript bundle leaked without any access control reveals a privileged API v2. A second-order SQL injection in the user's genre-preference flow extracts the administrators' bcrypt hashes — hashes that, thanks to a login endpoint that compares the client-supplied hash instead of the password, turn straight into working credentials without ever needing to be cracked. With an admin session, abusing ImageMagick's pseudo-protocols (vid:/msl:/caption:) delivers remote code execution as www-data. The .env file and the git history leak a developer's real password for the jump to a system user, and the final escalation abuses the cap_dac_read_search Linux capability on a "copyright scanner" binary, turning it into an MD5 oracle that rebuilds root's private SSH key one byte at a time, never reading it directly.

PlatformHack The Box
Operating systemUbuntu 22.04 (Jammy) — nginx 1.18.0 + PHP/Laravel, MySQL, ImageMagick (Imagick)
DifficultyHard
StatusRetired
Target IP10.129.229.27

Attack map

[80/HTTP] Laravel SPA -- admin.js leaked without authorization
   |  reveals the API v2 (admin) routes
   v
[2nd-order SQLi] genres -> feed -- space filter (/**/) and # terminator
   |  UNION SELECT ... from users -> bcrypt hashes for steve and greg (admin=1)
   v
[AUTH] POST /api/v2/auth/login {email,hash} -- compares the SUPPLIED hash
   |  logs in as steve WITHOUT cracking bcrypt -> admin session
   v
[RCE] /api/v2/admin/image/modify -- path=vid:msl:/tmp/php* + MSL file
   |  Imagick processes the upload as a script -> webshell -> www-data
   v
[POST-EXP] .env + git history (HOME=/tmp) -- test commit
   |  greg's real password leaked -> SSH -> user.txt
   v
[ROOT] /opt/scanner/scanner (cap_dac_read_search) -- byte-by-byte MD5 oracle
   |  /root/.ssh/id_rsa rebuilt without ever reading it -> SSH root -> root.txt

1. Reconnaissance

A ttl≈63 on the ping suggests Linux (initial TTL 64, one router hop). Full high-rate TCP port scan:

sudo nmap -p- --min-rate 3000 -T4 -Pn -oN nmap-allports.txt 10.129.229.27
PORT   STATE SERVICE
22/tcp open  ssh
80/tcp open  http

Only two ports. Version and script detection against both:

sudo nmap -p22,80 -sCV -Pn -oN nmap-services.txt 10.129.229.27
22/tcp open  ssh     OpenSSH 8.9p1 Ubuntu 3ubuntu0.1 (Ubuntu Linux; protocol 2.0)
80/tcp open  http    nginx 1.18.0 (Ubuntu)
|_http-title: Intentions

OpenSSH 8.9p1 Ubuntu 3ubuntu0.1 identifies Ubuntu 22.04 (Jammy). With only SSH and nginx exposed, the real attack surface is entirely HTTP — SSH will be the destination once credentials are obtained, not the way in.

🔒 Clearance required

This content is Root Access only. Everything else on the site — the free tier, the whole public library — stays open.

See Root Access plans

No account? Create one free then upgrade from your console.