Skip to content

BOLA & IDOR API Testing: Two-Account Playbook

How to test REST and GraphQL APIs for BOLA and IDOR vulnerabilities using paired test accounts, authorization matrices, and differential responses.

By BugSnaps · 3 min read · Updated

Add BugSnaps as a preferred source on Google(opens in a new tab)

Want more of our security guides? Select BugSnaps and confirm your choice on Google.

Broken Object Level Authorization (BOLA)—often referred to alongside Insecure Direct Object References (IDOR)—remains the #1 vulnerability in the OWASP API Security Top 10. It happens when an application authenticates a user's session token correctly, but fails to verify that the authenticated identity is authorized to read, modify, or delete the specific object ID passed in the URL path, query string, JSON body, or GraphQL variables.

Why single-account DAST scanners miss BOLA and IDOR

A vulnerability scanner running unauthenticated—or authenticated as only a single user—cannot reliably distinguish a valid object lookup from an unauthorized cross-tenant data leak. If User A requests `GET /api/v1/orders/9481` and receives HTTP 200 with an order payload, a single-session scanner has no way to know whether order 9481 belongs to User A or to another customer. Proving BOLA deterministically requires at least two separate test accounts (Account A and Account B) in distinct user or tenant scopes.

Two-account BOLA / IDOR test matrix across REST and GraphQL surfaces
API SurfaceBaseline Control (Account B)Cross-Account Probe (Account A Token)Pass vs Fail Evidence
Direct REST read (GET /api/invoices/{id})Account B fetches its own invoice ID and receives HTTP 200.Replay the exact GET request for Account B's invoice ID using Account A's session token.Pass: HTTP 403/404 with no data. Fail: HTTP 200 returning Account B's invoice fields.
State-changing write (PATCH / PUT / DELETE)Account B updates a harmless profile or project field on its own record.Send PATCH/DELETE targeting Account B's object ID with Account A's session.Pass: Rejected with no state change. Fail: Account B's record is modified or deleted.
Filtered collection / export (?orgId= or POST /export)Account B lists or exports records scoped to Tenant B.Supply Tenant B's organization or filter ID inside Account A's list or export request.Pass: Server ignores or rejects foreign orgId. Fail: Tenant B rows appear in response.
GraphQL object & nested resolver queryAccount B queries `node(id: ...)` or nested `organization { billing { invoices } }`.Execute the same GraphQL query and variables using Account A's authorization header.Pass: Resolver enforces ownership per node. Fail: Nested object resolves foreign data.

Step-by-step playbook for reproducing and fixing BOLA

  1. Provision two synthetic test accounts (User A in Tenant A, User B in Tenant B) and seed each with a recognizable marker value so cross-account leakage is unmistakable.
  2. Capture baseline requests as User B across read, update, export, and nested API routes to confirm the resource exists and returns expected data to its legitimate owner.
  3. Swap only the session cookie or Authorization bearer token to User A while keeping the object identifier from User B, then compare response status, body structure, and database state.
  4. Enforce object ownership in the data-access layer: scope every database query by the authenticated session's user_id and tenant_id (`WHERE id = $1 AND tenant_id = $2`) rather than relying on client-hidden UI buttons or unguessable UUIDs.

In authenticated assessment mode, you can supply two scoped test accounts to MyPentest to run paired-account access-control checks across discovered web and API routes.

Run a vulnerability scan on your website.

Verify your domain and use MyPentest to check for supported web and API weaknesses. Review findings and coverage; a clean scan does not rule out every CVE.