Ask one question before every request: who owns this object, and did the server compare that owner with me? Authentication tells the server who you are. Authorization tells it whether this specific record is yours.
The UI lists your records, so the brain assumes the server filters them. Often the server only checks that you are logged in, then looks up whatever ID the request supplies. The identifier becomes a key to every tenant's filing cabinet.
Your brain trusts the interface because it was designed for you. An attacker trusts the request because it is the only thing the server actually receives.
What is actually at stake?
Before touching a payload, map the assets, the actors and the boundary that is supposed to protect them. A finding only becomes a vulnerability when you can connect the failed boundary to a real asset.
Assets
- Customer invoices, tickets and documents
- Tenant identifiers and internal references
- Actions that change ownership or state
Actors
- Authenticated customer with a legitimate low-privilege account
- Malicious tenant or paid researcher
- Insider with access to one business unit
Trust boundaries
- Session identity to requested object
- Tenant to tenant
- User role to object action
- UI route to API handler
Abuse cases
- Increment a numeric identifier and read another tenant's record
- Swap a UUID copied from an export or GraphQL response
- Replay a state-changing request against another user's object
- Use a nested object reference that bypasses the parent check
Follow the decision, not the payload
Every family has a moment where trusted data becomes an authorization, parsing or state decision. Learn to point at that moment in the request path.
- 01
Authenticate
The session proves who you are. It does not prove which rows you may read.
- 02
Resolve the reference
The handler turns a path, query or body value into a database key, file name or downstream API call.
- 03
Authorize the object
A correct handler loads the object and compares its owner or tenant with the current subject before returning data.
- 04
Act
Read, update, delete or export the object. Every verb needs the same object-level decision.
- 05
Observe
A missing check usually looks like a normal 200 with different data; a correct check returns 403 or a deliberately indistinguishable 404.
Sequential document IDs at First American Financial
First American Financial, 2019, public reportingA public document portal exposed closing documents by changing a numeric identifier in a URL. Authentication was present; object-level authorization was not.
A researcher noticed that document links were sequential and that the server returned any document for a valid ID. No special tooling was required beyond editing the URL.
Public reporting described hundreds of millions of records exposed, including identity and financial information. The incident became a canonical example of why an unguessable URL is not an authorization control.
The application treated possession of an authenticated session as sufficient and never compared the document owner with the requester.
Load the object, derive the subject's tenant and role on the server, enforce the decision in one policy layer, and add two-account regression tests for every object route.
Read it as a chain: discovery → failed decision → impact → fix. Then ask which link would have broken earliest.
A repeatable testing sequence
- Map the identifiers you can see: invoice numbers, ticket IDs, user IDs, document names.
- Change one identifier at a time and compare status codes, body length and field names.
- Test list, detail, export, API and mobile endpoints; one may skip the ownership check.
- Look for sequential gaps. The missing ID is often the foreign record.
Where smart people get fooled
- Hidden links are not access control.
- Random or long IDs are obfuscation, not authorization.
- A 403 on one endpoint does not prove the whole object family is protected.
What would the logs show?
A control is stronger when someone can see it fail. These signals are starting points for a detection rule, not a complete SIEM use case.
- One session requests object IDs that belong to a different tenant or user
- A burst of sequential or nearby identifiers from the same account
- Successful 200 responses to IDs that never appeared in the user's UI
- Exports or GraphQL queries that return more objects than the caller owns
index=web sourcetype=app_logs status=200 | eval owner_match=if(requester_tenant=object_tenant,"yes","no") | where owner_match="no" | stats count values(path) by user_id, requester_tenant | where count > 3Fix the decision, then prove it stays fixed
- Enforce object-level authorization in the query or policy layer, not in the template.
- Scope every lookup by the authenticated tenant and user, and return 404 when it does not match.
- Add automated cross-tenant tests for every object type and every verb.
const invoice = await db.invoice.findUnique({ where: { id } });
return Response.json(invoice);const invoice = await db.invoice.findFirst({
where: { id, tenantId: session.tenantId }
});
if (!invoice) return new Response("Not found", { status: 404 });
return Response.json(invoice);Put the tenant predicate in the query, not in a later if statement that a future branch can skip. For updates, include the tenant in the WHERE clause and check the affected row count.
Regression tests a reviewer would ask for
Cross-tenant read
GivenTwo users in different tenants each own one object
WhenUser A requests User B's object identifier
ThenThe API returns 403 or an indistinguishable 404 and no object fields
Cross-tenant write
GivenUser A knows User B's object identifier
WhenUser A sends PATCH or DELETE for that object
ThenNo row changes and the response does not reveal whether the object exists
Nested reference
GivenAn endpoint accepts a parent ID and a child ID
WhenThe parent belongs to User A and the child belongs to User B
ThenThe request is rejected; the child is not resolved through the parent alone
Export and search
GivenA bulk endpoint accepts filters or pagination
WhenUser A searches without an owner filter
ThenThe server injects the tenant scope and never returns foreign rows
What this finding is not
Strong testers kill their own findings before someone else does. These are the shortcuts that turn a real bug into a weak report — or a false alarm into a wasted escalation.
- The identifier is a UUID and therefore hard to guess: unpredictability reduces discovery but is not authorization.
- The UI only lists your own records: the API can still accept a foreign identifier.
- The response is 403 for one guessed ID: test another tenant, another verb and a nested reference before concluding the control is complete.
- The endpoint requires a valid session: authentication is not the same as ownership.
Terms you should be able to use precisely
- Object-level authorization
- A decision about whether this subject may perform this action on this specific object.
- IDOR
- Insecure Direct Object Reference: a reference controlled by the client reaches an object without an ownership check.
- Tenant isolation
- The guarantee that data and actions in one customer organization cannot affect another.
- BOLA
- Broken Object Level Authorization, the API Security term for the same failure class.
- Indistinguishable 404
- Returning the same not-found response whether an object is absent or forbidden, so the API does not confirm existence.
- Mass assignment adjacent
- A related failure where a client changes an object field such as ownerId instead of the object reference itself.
Answer these without reciting a payload
Why is a random UUID not an access control?
Authorization must be based on the subject's relationship to the object, not on the difficulty of guessing the identifier. UUIDs leak through exports, logs, referrers and APIs, and an insider can still obtain them.
Where should the tenant check live?
In the data-access policy or query itself, close to the object load, and be reused by every verb. A check in one controller is fragile because new routes and bulk operations bypass it.
How do you test for blind IDOR?
Use two accounts, perform a state-changing request against the other account's object, then verify the effect from the victim session. Compare response timing and status codes only as secondary signals.
Can you separate the mechanism from the payload?
Four questions, graded on the server. Answers and explanations are released only after you submit, and signed-in learners keep a best score.
الثغرة الحقيقية هنا ليست في الرقم التسلسلي، بل في أن الخادم عرف من أنت ثم نسي أن يسأل: هل هذا الكائن يخصك؟
UUID أو رابط مخفي لا يحلان المشكلة؛ التخمين يصبح أصعب فقط. الحل الصحيح هو ربط كل قراءة وكتابة وحذف بهوية المستخدم والمستأجر داخل طبقة الصلاحيات نفسها، ثم اختبار ذلك بحسابين منفصلين. أي مسار جديد أو تصدير أو استعلام متداخل يجب أن يمر بنفس القرار.
If you changed the ID and received 200, what exactly did the server fail to compare?