Blog
Web & API2026-11-21 · 5 min read

IDOR explained: how broken object-level authorization leaks data

IDOR — Insecure Direct Object Reference, now often called broken object-level authorization — is one of the most common and most damaging web/API bugs. It happens when an endpoint uses a client-supplied identifier to fetch a resource without checking that the caller is actually allowed to see that resource.

The trap: two paths, one resource

Most IDOR bugs are not a missing auth check in the obvious place — the single-resource endpoint is usually fine. The bug appears when a second path reaches the same data with weaker checks: a bulk endpoint, a v2 API, a GraphQL resolver, a background job, an export. Scanners rarely connect the two.

// GET /notes/:id  — scoped, safe
prisma.note.findUnique({ where: { id, ownerId: user.id } })

// POST /notes/batch  — same data, no ownership filter
prisma.note.findMany({ where: { id: { in: body.ids } } })  // IDOR

The bulk query trusts body.ids and never scopes by owner. Any authenticated user can enumerate ids and read other tenants’ data — a cross-tenant confidentiality breach (CWE-639, typically CVSS ~7).

How to find it in source code

  1. List every path that reads a given model — not just the REST CRUD route.
  2. For each, check whether the query is scoped to the caller (ownerId, tenantId, membership).
  3. Flag any sibling that reaches the same table with a different (or missing) scope.
  4. Confirm the identifier is user-controlled and reachable from an authenticated-but-unprivileged user.

How to fix it

Enforce ownership at the data layer, not the route: add the scope to every query (ownerId: userId), and centralize access in a repository helper so a new endpoint can’t forget it. Where possible, make the unscoped query impossible to write.

This is exactly the kind of multi-path inconsistency a manual source-code audit is built to catch. See a sample report with a real IDOR finding, or get your code audited.