A simple diagram of the Broken Access Control and IDOR risk path
Risk path: an input or context crosses a security boundary.
A simple three-step test path for Broken Access Control and IDOR
Testing path: establish a baseline, make one controlled change, and verify the effect.

01Issue

Overview

Authentication answers “who is making this request?” Authorization answers “may this identity perform this action on this resource, in this context?” Broken access control occurs when the application omits that second decision, applies it inconsistently, or trusts a decision made only in the browser. The boundary may depend on role, ownership, organization or tenant, sharing state, subscription, workflow stage, record sensitivity, or the relationship between two resources. A user who may view a document, for example, may still be forbidden to edit it, download an attachment, view its audit history, or share it.

An insecure direct object reference (IDOR) is an object-level form of broken access control. A request contains a reference such as /api/orders/4812, ?file=quarterly-report.pdf, a UUID, slug, GraphQL node ID, storage key, or JSON field. The server uses that reference to load an object but does not verify that the current identity may perform the requested operation on that exact object. IDOR is often called broken object level authorization (BOLA) in API guidance. The weakness is the missing authorization decision, not the presence of a visible identifier. Sequential identifiers can make discovery easier, while UUIDs and opaque tokens can reduce guessing, but neither proves permission.

Broken access control also includes function-level and contextual failures: an ordinary user directly calls an administrator route; an account keeps access after removal from a team; a user changes an ownerId or tenantId; a bulk endpoint checks only one item; or a background export runs with broader permissions than the request that created it. Client-side button hiding, route guards, and disabled form controls improve the interface but cannot protect a server endpoint because a caller can construct the request directly.

Common causes

  • The server checks that a session or token is valid but does not check ownership, sharing, tenant membership, role, or the requested action.
  • Authorization is implemented separately in controllers, resolvers, jobs, and storage routes, so some read, update, delete, download, history, or export paths omit the policy.
  • The interface hides a control or route from lower roles, but the server trusts that client-side restriction.
  • The application loads an object by a client-supplied identifier before scoping the query to the current user or tenant.
  • A request supplies security-sensitive relationship fields such as ownerId, accountId, tenantId, or role, and the server trusts them instead of deriving them from authenticated context.
  • A nested route checks the parent but not the child, or fails to prove that the child belongs to the authorized parent.
  • Bulk, search, GraphQL, attachment, export, background-job, legacy, or mobile endpoints apply a weaker policy than the primary route.
  • Permission changes, logout, team removal, or link revocation do not invalidate cached decisions, signed URLs, sessions, or queued work.

References: OWASP Authorization Cheat Sheet ↗OWASP WSTG: Testing for Bypassing Authorization Schema ↗OWASP WSTG: Testing for Insecure Direct Object References ↗OWASP API1:2023 Broken Object Level Authorization ↗CWE-639: Authorization Bypass Through User-Controlled Key ↗

02Examples

EXAMPLE

Illustrative two-account test: account A creates invoice INV-A-100; account B creates INV-B-200. While signed in only as A, capture the allowed request GET /api/invoices/INV-A-100, then change only the path to GET /api/invoices/INV-B-200. A secure server may return 403, 404, or a deliberately filtered public representation according to its policy. A 200 status alone is not a finding, and a 404 alone does not prove the control works. Confirm whether B’s protected customer name, line items, totals, attachment, or other private fields are returned. For a write test, make a reversible change to B’s synthetic record, fetch it as B, and restore it after evidence is captured. Do not enumerate unknown production identifiers or access real user data.

03Impact

A protected resource or function must be reachable, the current identity must lack permission for the tested object-and-action pair, and the server must nevertheless return protected data or complete the operation. Establish the intended policy first, then use synthetic records and at least two controlled accounts, roles, or tenants. Knowing or changing an identifier is only the test input; confirmation comes from the response content, persisted state, downloaded file, audit event, or other observable result.

The effect follows the permission that was bypassed. Horizontal access crosses between users or peer accounts; vertical access crosses roles, such as user to administrator; cross-tenant access crosses organizational isolation. A read flaw may disclose profiles, messages, invoices, documents, or attachments. A write flaw may alter ownership, approvals, payment details, or workflow state. Delete, share, export, and administrative flaws can cause loss of data, broader disclosure, fraud, or privilege escalation. Scope matters: one predictable public display name is different from a tenant-wide bulk export. A changed status code, object-existence signal, visible UUID, or response containing only intentionally public fields is not enough to claim data access. Record exactly which protected fields or actions were obtained and under which identity.

04Testing

Test cases

1. Check cross-account writes and actions

Create separate invoices for test accounts A and B. Capture an allowed update to A’s invoice. Replay it with A’s token, changing only the URL invoice ID to B’s known ID; use a reversible label. Read B’s invoice afterward as B. Repeat for supported delete, share, and export actions with safe fixtures.

Example: Expected: B’s invoice stays unchanged and A receives no private export. Proof requires the resulting state or output; a denial status alone cannot rule out a partial write.

PATCH /api/invoices/INV-B-200 HTTP/1.1
Host: app.example.test
Authorization: Bearer ACCOUNT_A_TEST_TOKEN
Content-Type: application/json
 
{"label":"ACCESS-TEST"}

2. Check restricted fields in an allowed update

Give test account A permission to change a document title but not its approval state. Capture a normal title update, then add only the restricted approved field. Fetch the document again through an authorized view and check the approval workflow.

Example: Expected: the title can change but approval remains unchanged. An echoed field or successful HTTP status is not proof that the protected value was saved or used.

PATCH /api/documents/DOC-A-100 HTTP/1.1
Host: app.example.test
Authorization: Bearer ACCOUNT_A_TEST_TOKEN
Content-Type: application/json
 
{"title":"Quarterly draft","approved":true}

3. Check mixed ownership in a batch action

Create one test invoice owned by A and one owned by B. Capture a valid batch action as A, then add B’s known invoice ID to the same invoiceIds array. Keep A’s token and other fields unchanged. Read both invoices afterward as their owners.

Example: Expected: the action never changes or exports B’s invoice. Document whether the API rejects the whole batch or safely processes only A’s item; either may match the product policy.

POST /api/invoices/bulk-approve HTTP/1.1
Host: app.example.test
Authorization: Bearer ACCOUNT_A_TEST_TOKEN
Content-Type: application/json
 
{"invoiceIds":["INV-A-100","INV-B-200"]}

4. Check private responses across cache users

Place a harmless unique marker in A’s private test record. Request its URL as A, then request the same URL as B and without a session through the normal cache path. Keep the URL identical and change only the credentials.

Example: Expected: B and anonymous callers do not receive A’s marker or private fields. Confirm the response came through the shared cache before describing a cache isolation flaw.

GET /api/invoices/INV-A-100 HTTP/1.1
Host: app.example.test
Authorization: Bearer ACCOUNT_B_TEST_TOKEN

5. Check whether a read-only share link grants extra actions

Create a private test document and a read-only link for account B. Confirm B can open it, then use the same link to attempt a reversible title change. Keep the link and B’s identity unchanged; change only the method and operation.

Example: Expected: the link permits reading under its stated rules but cannot edit the document. Fetch the document as its owner to confirm the title remained unchanged.

PATCH /api/shared/TEST_READ_ONLY_LINK/document HTTP/1.1
Host: app.example.test
Authorization: Bearer ACCOUNT_B_TEST_TOKEN
Content-Type: application/json
 
{"title":"ACCESS-TEST"}

6. Check access across workflow states

Create a test request that A may edit while it is a draft. Capture the valid edit, submit or approve the request using the normal workflow, then replay the same edit with A’s unchanged token and object ID. Read the request again as an authorized reviewer.

Example: Expected: edits are denied once the request reaches a locked state, unless the documented policy allows them. Verify the persisted state rather than relying on the response code.

PATCH /api/requests/REQ-A-100 HTTP/1.1
Host: app.example.test
Authorization: Bearer ACCOUNT_A_TEST_TOKEN
Content-Type: application/json
 
{"description":"ACCESS-TEST-AFTER-APPROVAL"}

7. Check delegated access after a grant changes

Grant B temporary read access to A’s test document and confirm a normal read. Narrow or expire the grant through the authorized owner workflow, then repeat the identical read with B’s existing session. Check any returned fields against the new grant.

Example: Expected: the response reflects the current grant and excludes revoked fields. A previously opened page is not proof of continuing server access; replay the API request.

GET /api/documents/DOC-A-100 HTTP/1.1
Host: app.example.test
Authorization: Bearer ACCOUNT_B_TEST_TOKEN

8. Check authorization when queued work finishes

Start an export of A’s synthetic document through an authorized test account. Before the job finishes, remove that account’s access using the normal workflow. Request the resulting job or download URL with the same session.

Example: Expected: delivery follows the product’s documented revocation policy and does not reveal data after access should end. Capture the grant change, job status, and actual downloaded content.

GET /api/exports/JOB-TEST-100/download HTTP/1.1
Host: app.example.test
Authorization: Bearer REVOKED_TEST_TOKEN

9. Check references discovered through previews or activity

Create separate test documents for A and B. From a preview, thumbnail, activity entry, or webhook payload, record B’s known related-object ID. While signed in as A, request that related object directly, changing only the ID from an allowed baseline.

Example: Expected: each related resource checks A’s access independently and returns no private B content. Seeing an ID in metadata alone is not proof of access.

GET /api/attachments/ATTACHMENT-B-200/preview HTTP/1.1
Host: app.example.test
Authorization: Bearer ACCOUNT_A_TEST_TOKEN

10. Check cross-account reads

Create separate invoices for A and B and put a harmless marker in B’s invoice. Capture A’s valid read, then change only the URL ID to B’s known invoice ID while retaining A’s token. Compare the response with the intended sharing policy.

Example: Expected: A receives no protected B fields unless the invoice is explicitly shared for reading. A visible ID or a 200 response without private data does not establish a finding.

GET /api/invoices/INV-B-200 HTTP/1.1
Host: app.example.test
Authorization: Bearer ACCOUNT_A_TEST_TOKEN
Accept: application/json

11. Compare supported object ID locations

For one test resource, identify the supported path, query, body, or nested references. Capture an allowed request in each format, then replace only the resource ID with a known object outside A’s permissions. Compare the actual response and resulting state.

Example: Expected: every supported representation enforces the same object permission. An opaque or encoded ID is still only a reference; its presence alone is not a vulnerability.

GET /api/invoices?invoiceId=INV-B-200 HTTP/1.1
Host: app.example.test
Authorization: Bearer ACCOUNT_A_TEST_TOKEN

Testing references: OWASP Authorization Cheat Sheet ↗OWASP WSTG: Testing for Bypassing Authorization Schema ↗OWASP WSTG: Testing for Insecure Direct Object References ↗OWASP API1:2023 Broken Object Level Authorization ↗CWE-639: Authorization Bypass Through User-Controlled Key ↗

05Mitigation

Define one deny-by-default authorization policy for each resource and action, then enforce it on the trusted server side after authentication. Prefer scoped data access such as loading an invoice through the current tenant’s authorized invoice collection instead of loading a global invoice by ID and relying on a later ad hoc check. Centralize policy code or middleware where the framework supports it, while still passing the actual resource, action, identity, tenant, and relevant relationship into the decision. Derive owner and tenant from authenticated server context; explicitly allowlist any relationship changes the caller may make. Validate both parent-child membership and permission on nested resources. Apply the same policy to web and mobile APIs, GraphQL resolvers, search, bulk operations, attachments, exports, object storage, caches, background jobs, and administrative tools. Recheck authorization when delayed work executes or preserve a narrowly scoped, auditable grant that can be revoked. Invalidate sessions, caches, signed links, and queued access when the policy requires revocation. Log denied and high-risk decisions with actor, action, resource, and policy result, but exclude secrets and unnecessary personal data. Use UUIDs or opaque references only to reduce accidental discovery; they are defense in depth, not authorization. Add automated positive and negative tests generated from the authorization matrix so every route proves both intended access and intended denial.

Retest

Recreate the authorization matrix with fresh synthetic objects and repeat every previously affected request as the owner, a same-role non-owner, a different-tenant user, a lower role, and the intended privileged role. Confirm denied reads contain no protected fields, denied writes and deletes leave state unchanged, nested and bulk routes reject mixed ownership, and revoked access no longer works through caches, downloads, exports, or background jobs. Also confirm authorized ownership, sharing, and administrator workflows still succeed. Preserve the identity, request, response, before-and-after state, and policy expectation for each regression case.