No Insecure Direct Object References (IDOR)
Why it matters
IDOR (Insecure Direct Object Reference) — CWE-639, CAPEC-143 — is one of the most reliably exploitable authorization failures: an attacker supplies someone else's resource ID and receives that resource. OWASP A01 (Broken Access Control) names IDOR as a primary example. The threat model is simple: authenticated user A calls GET /api/invoices/invoice-uuid-owned-by-user-B and receives user B's invoice. UUIDs reduce guessability but are not authorization controls — they merely slow brute-force enumeration. NIST 800-53 AC-3 requires access enforcement based on identity, not identifier obscurity. A single IDOR-vulnerable endpoint exposes every record in the affected table to any authenticated caller.
Severity rationale
Critical because the attack requires only authentication and knowledge of one valid ID — no privilege escalation, no chaining, just a direct read or write of another user's data.
Remediation
The fix is identical to resource ownership verification: include the user's ID in every query that fetches by a client-supplied ID. This applies whether the ID is in the URL path, a query parameter, or the request body.
// Pattern for every route with [id]:
const resource = await db.invoice.findFirst({
where: { id: params.id, userId: session.user.id }
});
if (!resource) return NextResponse.json({ error: 'Not found' }, { status: 404 });
For cross-resource access (user has access through their organization), verify via the organizational membership table — db.orgMember.findFirst({ where: { orgId: resource.orgId, userId: session.user.id } }) — rather than checking direct ownership.
DetectionPro
The detection method for this pattern is part of AuditBuffet Pro.
The full method (what to look for, pass and fail conditions, and how results get reported) ships inside the Authorization Audit. The pattern definition, severity rationale, and remediation remain openly licensed under CC-BY-4.0.
External references
- cwe · CWE-639 — Authorization Bypass Through User-Controlled Key
- cwe · CWE-284 — Improper Access Control
- owasp:2021 · A01
- capec · CAPEC-143 — Detect Unpublicized Web Services
- nist:rev5 · AC-3
- soc2:2017 · C1.1 — Identification and protection of confidential information
- soc2:2017 · CC6.1 — Logical access security software, infrastructure, and architectures
Taxons
History
- 2026-04-18·v1.0.0·Initial import from saas-authorization·automated
- 2026-07-06·v1.0.1·Add SOC 2 TSC mapping (C1.1, CC6.1) from the verified compliance crosswalk register (docs/compliance/).·by soc2-mapping-enrichment-ship-2