$ cat writeup.md…
$ cat writeup.md…
HackTheBox
| Property | Value |
|---|---|
| Event | HackTheBox |
| Category | Web |
| Difficulty | Hard |
| Flag | HTB{REDACTED} |
The crew has uncovered the IP address of a web interface used by the mercenary group called "Gunners" to track and spy on their enemies. To locate an elusive black market dealer for a critical trade, the team must hack into this gunners network and retrieve the last known location of a caravan that was recently ambushed in the wasteland.
The challenge consists of multiple services working together:
┌─────────────────────────────────────────────────────┐
│ Varnish Cache │
│ (cache.vcl configuration) │
└─────────────────┬───────────────────┬───────────────┘
│ │
┌─────────────────▼─────────┐ ┌───────▼───────────────┐
│ Controller Service │ │ Oracle Service │
│ (Python/Flask :3000) │ │ (Zig/http.zig :4000) │
│ │ │ │
│ - Authentication │ │ - Device location API │
│ - Device management │ │ - CRLF vulnerable │
│ - Firmware updates (LFI) │ │ │
│ - Admin panel │ │ │
└─────────────────┬──────────┘ └───────────────────────┘
│
┌─────────────────▼──────────┐
│ MySQL DB │
│ │
│ - Users table │
│ - Signatures table │
│ - Devices table │
└────────────────────────────┘
┌────────────────────────────┐
│ Chromium Bot │
│ (runs every 30 seconds) │
│ │
│ 1. Visit login page │
│ 2. Wait 3 seconds │
│ 3. Login as moderator │
│ 4. Wait 3 seconds │
│ 5. Visit /oracle/json/{id} │
└────────────────────────────┘
The Oracle service is built with Zig's http.zig library. Route parameters are URL-decoded and reflected in response headers without proper sanitization.
Exploitation:
deviceId parameter is URL-decodedDeviceId response header%0d%0a (CRLF) to add arbitrary headersCacheKey: enable and Content-Type: text/htmlThe Varnish configuration uses a custom cache key mechanism:
Impact:
CacheKey header share the same cache entryCacheKey: enable via CRLF causes response to be cachedThe mode parameter in /oracle/:mode/:deviceId is reflected in the HTML body. Combined with Content-Type injection enables full XSS execution.
The bot has a predictable timing pattern with /controller/bot_running endpoint revealing bot status.
The firmware endpoint uses os.path.join() insecurely - absolute paths bypass the base directory.
The device endpoint uses f-string formatting with multi=True allowing stacked queries.
/controller/firmware$ cat /etc/motd
Liked this one?
Pro unlocks every writeup, every flag, and API access. $9/mo.
$ cat pricing.md$ grep --similar