Skip to content

Broken Access Control / IDOR

← Back to index · Stage 2 (reach /admin) · Read the mindset page first.

Why it exists: access control is a check the app must perform on every sensitive action — "is this user allowed?" Broken access control is simply a check that's missing, shallow, or trusts something you control. The admin page that only hides its link but doesn't re-verify your role; the account lookup that trusts an id you can change. It's the most common Stage-2 route on BSCP because gating /admin correctly is easy to get subtly wrong.

The one rule: access-control bugs are found by asking for things you shouldn't have, not by clever payloads. Enumerate the privileged actions/objects → request them as a low-priv user → if blocked, tamper the role/ID/URL/method the check relies on.

Decision tree

flowchart TD
  A["Goal: an admin function / another user's data"] --> B{"What kind?"}
  B -->|admin-only function| V["Vertical: reach /admin"]
  B -->|another user's object| H["Horizontal: IDOR"]
  V --> C{"How is it gated?"}
  C -->|just hidden| DIR["Request it directly"]
  C -->|role in a request value| ROLE["Flip role / isAdmin"]
  C -->|URL-match check| URLT["Case / path / header trick"]
  C -->|method check| METH["Change POST to GET"]
  H --> ID["Swap id to victim / administrator"]
  DIR --> WIN["Admin reached"]
  ROLE --> WIN
  URLT --> WIN
  METH --> WIN
  ID --> WIN

Reading the response: the signal is the difference between your request and a privileged one. A 403 or a redirect to /login = still blocked; a 200 carrying admin-only content (a user-management table, a different menu, another user's data) = the check was bypassed. Always diff a tampered request against your low-priv baseline — the admin content appearing is your proof, not the absence of an error.

1. Vertical — reach admin functions

Why "just hidden" works: many apps only remove the link to /admin for non-admins but never re-check the role on the endpoint itself — so requesting it directly works.

GET /admin                       # find the path in JS / robots.txt if not linked
POST /admin/delete-user          # the action endpoint may not re-check, even if /admin does
username=carlos

2. Horizontal — IDOR

Why it works: the app uses an identifier you supply to fetch an object, but never checks that the object belongs to you. Change the id → get someone else's data.

GET /my-account?id=administrator
GET /api/orders/1337             # increment/guess; GUIDs may leak in another feature

3. Parameter / role tampering

Why: if your role travels in a request value (a cookie, a hidden field, a JSON body), the server trusts data you can edit. Flip it.

roleid=2 -> roleid=1          Cookie: Admin=false -> Admin=true
{"username":"me","isAdmin":true}   # on registration/update (mass assignment)
If the role is in a JWT, see the JWT page.

4. URL-match & method bypasses — why they slip through

Why: the access check and the router often normalise the URL/method differently. A check that matches exactly /admin may miss /ADMIN or /admin/, or a front-end control honours an override header the back-end also reads:

GET /ADMIN            # case
GET /admin/           # trailing slash
X-Original-URL: /admin   /   X-Rewrite-URL: /admin
# method: the check guards POST but the handler also accepts GET -> switch

Failure modes

  • 403 on /admin → try case, trailing slash, X-Original-URL, or a method swap — the check and router may disagree.
  • Role flip ignored → the role is enforced server-side; look for it in a JWT/cookie instead.
  • IDOR returns nothing → the id is a GUID; hunt for it leaking in another feature (a message, a review).
  • Reached data but not admin → you have horizontal access only; find the vertical step to escalate privilege.