Authorization enforces object-level access control
Why it matters
Broken Object Level Authorization (OWASP API Security Top 10 2023 API1) is the single most exploited API vulnerability class. Authentication confirms who you are; object-level authorization confirms what you can touch. Without it, any authenticated user can substitute another user's ID in a URL and retrieve or modify that user's data — orders, messages, payment methods, medical records. CWE-639 (Authorization Bypass Through User-Controlled Key) describes exactly this pattern: the key is user-supplied, the backend trusts it. Real-world incidents like the Optus breach involved straightforward IDOR on predictable object IDs.
Severity rationale
Critical because any authenticated attacker with a valid session can exfiltrate or overwrite other users' private data by incrementing or guessing resource IDs.
Remediation
After authenticating the user, always fetch the resource and compare its owner field against the authenticated user's ID before returning or modifying it. Never trust a resource ID from the URL without verifying ownership server-side.
// src/app/api/orders/[id]/route.ts
export async function GET(req: Request, { params }: { params: { id: string } }) {
const user = await getAuthUser(req)
if (!user) return new Response('Unauthorized', { status: 401 })
const order = await db.order.findUnique({ where: { id: params.id } })
if (!order) return new Response('Not Found', { status: 404 })
// Ownership check — do this before returning any data
if (order.userId !== user.id) return new Response('Forbidden', { status: 403 })
return Response.json(order)
}
Apply the same pattern to PATCH, PUT, and DELETE handlers.
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 API Security Audit. The pattern definition, severity rationale, and remediation remain openly licensed under CC-BY-4.0.
External references
- cwe · CWE-285 — Improper Authorization
- cwe · CWE-639 — Authorization Bypass Through User-Controlled Key
- owasp:2021 · A01 — Broken Access Control
- owasp:2023 · API1 — Broken Object Level Authorization
- soc2:2017 · CC6.1 — Logical access security software, infrastructure, and architectures
- soc2:2017 · C1.1 — Identification and protection of confidential information
Taxons
History
- 2026-04-18·v1.0.0·Initial import from api-security·automated
- 2026-07-06·v1.0.1·Add SOC 2 TSC mapping (CC6.1, C1.1) from the verified compliance crosswalk register (docs/compliance/).·by soc2-mapping-enrichment-ship-2