← Broken Access Control lesson
FoundationsBroken Access ControlFoundation25 min+100 XP

Cookie With a Crown

The Support Portal has a broken authorization boundary. Reach the administrative secret.

“The login was perfect. The door next to it was open.”

CWE-284OWASP Top 10 A01:2021OWASP ASVS 4.1
The story
Every request needs two answers: who is calling, and may this caller perform this action on this object right now? A login page only answers the first.

Routes rely on hidden links, client-side role checks, or a single check at the entry point. The attacker requests the admin route directly, changes a cookie, uses a different HTTP method, or reaches an older API version.

Your objective
  • Map the authentication flow
  • Find the missing or bypassable check
  • Reach the admin console and capture the flag
Boundary under test

Route to role

Field guide · request anatomy

Where to look before you type a payload

01Authenticate

Identify the subject, session strength and any step-up requirements.

02Map the request

Normalize the path, method, API version and action. Aliases and legacy routes must map to the same policy.

03Evaluate policy

Decide function-level access, data scope and context in one place. Deny by default when no rule matches.

04Enforce

Apply the decision at the server boundary, before side effects, and repeat it in background jobs that act on user intent.

Progressive hints

Open one hint at a time. The first two build the model; the last two point at the boundary.

Hint 1

Enumerate routes, roles and API versions.

Hint 2

Try the admin route even if the UI does not link it.

Hint 3

Authorization is read from the role cookie. Set it to admin.

Hint 4 · near the answer

Reach the admin console and capture the flag.

Guided workbench

Observe → Hypothesize → Test → Prove → Explain

This is the same loop a reviewer expects in a report. Your draft stays in this browser; nothing is submitted until you choose to export it.

0/15steps complete
Observe0/3
Hypothesize0/3
Test0/3
Prove0/3
Explain0/3

Evidence log

Write for a reviewer who was not in the room. Every claim needs a request, response or state change behind it.

Preview the evidence report
# Lab evidence report — Cookie With a Crown

- Family: Broken Access Control
- Lab ID: web-auth-cookie-crown
- Date: 2026-12-05

## Workflow

### Observe

- [ ] Open "Cookie With a Crown" and record /login, the HTTP method and the role you are given.
- [ ] List every parameter, header, cookie and object identifier the normal flow exposes.
- [ ] Save a baseline response: status, body shape, timing and the fields that change by user.

### Hypothesize

- [ ] Name the server decision that protects /login, and the evidence it should use.
- [ ] Use the clue as a constraint, not an answer: Authorization is decided by a client-side cookie. Change your role to admin.
- [ ] Predict the exact status, body or state change that would prove the decision is missing.

### Test

- [ ] Start from the baseline and change one value: the role cookie.
- [ ] Keep the request replayable; vary encoding, method or identifier location only after the first result.
- [ ] Capture the full request and response for the winning attempt, including the flag.

### Prove

- [ ] Capture the flag and name the exact foreign object, role or state change it proves.
- [ ] Repeat from a clean session and confirm the result is not cached or stale.
- [ ] State impact precisely: what data or action did you actually obtain?

### Explain

- [ ] State the root cause without naming the payload: which decision failed?
- [ ] Name the control that prevents recurrence and the layer where it belongs.
- [ ] Write one regression test that fails before the fix and passes after it.

## Evidence

### Target and baseline

_Not recorded._

### Hypothesis

_Not recorded._

### Winning request

_Not recorded._

### Proof

_Not recorded._

### Root cause

_Not recorded._

### Control and regression test

_Not recorded._

## Analyst conclusion

The proof demonstrates the missing control above. The regression test should fail against the vulnerable behavior and pass after remediation.
Solution and debrief
Locked until you capture the flag.

The full request, the reasoning and the debrief unlock after a successful capture. That is deliberate: struggle first, then consolidate.

What a reviewer will ask

False positives to rule out

  • The admin button is hidden: hidden UI is not access control.
  • The route returns 403 for GET: test POST, PUT, PATCH and DELETE, plus the legacy API version.
  • A role claim exists in the token: the server must verify the claim and map it to a policy, not trust it blindly.

Regression tests to name

  • Function matrix: Only explicitly allowed combinations succeed; everything else is denied
  • Method tampering: All verbs receive the same policy decision
  • Legacy alias: The alias resolves to the same policy and is not a bypass
The defender's move
  • Deny by default and centralize policy checks.
  • Test every route, method and role, including legacy APIs.
  • Return 404 for objects the caller may not know about.
See the secure-code pattern and all 4 regression tests →
الخلاصة

تسجيل الدخول لا يعني الصلاحية؛ كل طلب يحتاج قرار تصريح.