Authorization decides whether an authenticated principal may perform this action on this resource in this state and tenant. When it breaks, a valid session (or a free guest identity) becomes a key to other users’ data, other tenants, admin functions, or the platform underneath, without any injection payload.
What it is
Authentication answers who is calling; authorization answers may they do this here. The trust boundary that breaks is between the server’s own record of the caller’s rights and anything the caller influences: object IDs, role flags, tenant headers, token claims, request paths, or an agent’s tool arguments. Adding authentication alone fixes nothing. Peloton’s first “fix” for an open user-data API required a login, so any of its ~3M self-registered customers could still pull any other customer’s private profile.
Control axes (PortSwigger), plus the two boundaries modern apps add:
The OWASP API 2023 split matters for fixes: a mass-assignment bug filed as BOLA gets the wrong fix, and a role check (“is this user an editor?”) routinely gets mistaken for an object check (“may this editor edit document 4411?”). Most BOLA found in code sits behind a role check someone believed was enough.
Why the class persists:
No signature. The bug is a missing AND owner_id = ?, a role check scoped to the wrong org, or a handler outside the middleware. SAST understands structure, not business intent; Auth0 calls BAC/BOLA “logical” rather than “technical” vulnerabilities.
Check sprawl. Decisions are imperative code repeated per route, resolver, worker, export and agent tool. Authz must succeed N of N times.
Unsafe defaults. Find-by-id ORMs (Order.find(params[:id]) returns any row), route-level middleware that hands controllers an unchecked ID, services trusting a gateway plus a caller-supplied X-Tenant-Id, and framework routes that ship open (Rails ActiveStorage).
The rule lives in the product. “Invoices belong to orgs; cross-org reads are never legitimate” isn’t in the code, so AI coding agents write endpoints that authenticate, handle not-found, read cleanly and omit the org scope (AI Coding Assistant Risks).
Why it matters
Prevalence: OWASP Top 10 A01 in 2021 and 2025. In 2025, 100% of tested apps had some BAC; 40 CWEs, 1,839,701 occurrences, 32,654 CVEs. The category now absorbs CWE-918 (Server-Side Request Forgery) and CWE-352 (CSRF). BOLA is API1 in both the 2019 and 2023 API lists (OWASP API Security Top 10).
Impact ladder (each rung with a real example below):
Read one foreign object (PortSwigger GUID lab: another user’s API key).
Provider control plane or infrastructure (Azure API Connections, CosmosEscape; app → Kubernetes/IAM).
Severity drivers: data class (in KYC/finance flows a missing ownership check is High even on an empty test draft), write vs read, scope change across tenants (Chatwoot scored CVSS 6.6 with S:C), number of reachable objects, and privileges needed (guest < any user < admin somewhere). A cross-tenant read+write scores CVSS:3.1/AV:N/AC:L/PR:L/UI:N/S:U/C:H/I:H/A:N = 8.1; score what you actually reached.
Breaches, not just bounties: Peloton, Kia (dealer-portal tokens controlling arbitrary vehicles by plate), Qubole cross-account roles abused in the wild, and the Cognito/AppSync user-database scrape.
How it works
Object-level (IDOR/BOLA)
The endpoint accepts a client-supplied identifier and never asks whether the subject may act on that object. Variants beyond the textbook path swap:
Body IDs on writes.PATCH /documents/d-123 checks that d-123 is yours, then accepts {"project_id":"p-999"} after checking only that p-999exists. The response embeds B’s project (name, owner email). Laravel exists:projects,id and plain foreign keys are existence checks, not ownership checks, and Postgres integrity checks (FKs) bypass RLS by design.
Uncorrelated queries. Frappe’s get_contact_number (CVE-2026-134371) used an uncorrelated EXISTS subquery, so any Contact’s mobile_no/phone came back.
Nested routes (/orgs/{orgId}/projects/{projectId}/files/{fileId}) validate the parent and load the child globally.
Batch/bulk endpoints authorize the envelope or first element only.
The object check passes but a field doesn’t: writable role, verified, tenant_id, ClassName, or a related field leaking through a notification (ERPNext Document Follow). See Mass Assignment, Privilege Escalation.
Function-level
A handler, version or action sits outside the mechanism every sibling uses: a missing annotation (SGLang @auth_level), deprecated /api/latest/fleet/mdm/apple/enqueue (Fleet), a sidecar proxied through the main app (Splunk), a bulk admin action that skips per-object checks (django-filer), or a framework default route (ActiveStorage direct_uploads, CWE-306). See Function Level Authorization.
Gate bypass
The gate and the handler see different requests: client-settable X-Original-URL/X-Forwarded-For/Referer/Host, framework-internal headers (x-middleware-subrequest), or path-normalization differentials. See Header-Based Access Control Bypass, URL Parser Differentials.
Privilege escalation
The server trusts a caller-influenced role (?admin=true, roleid in a profile body, unverified token claims), scopes a role check too broadly (“admin somewhere”), or lets type/parent changes bypass per-type checks. See Privilege Escalation, JSON Web Tokens, JWT Algorithm Confusion.
Tenant isolation
Ordinary authz bugs whose scope is the tenant; also shared session stores, unscrubbed storage, and provider control planes that hold rights over every tenant. See Multi-Tenant Isolation.
Lifecycle and context
Revocation, removal, downgrade and soft-delete don’t invalidate derived access (retained pageId, still-writable is_deleted=1 invoice, follows that keep notifying). Workflow step 3 checked less than steps 1–2. See Broken Access Control.
GraphQL
One object, many resolvers; root fields authorized and nested edges trusted. Engine bugs too: graphql-ruby Execution::Next skipped class-level.authorized? on resolvers/mutations (instance #authorized? still ran), and GHSL-2026-152 ran resolve even after authorized? raised. See GraphQL Authorization Flaws, GraphQL Security.
Agents and MCP
The agent is a new principal between user and tools. Prompt injection is framed as an access-control problem: the damage is bounded by the agent’s privileges, so least privilege is the control. Viewer + agent = executor (n8n). See AI Agent Authorization, MCP Security, Agentic AI Risks, Prompt Injection.
Design layer
Which data drives the decision (ACL/RBAC/ABAC/ReBAC) and where it’s computed and enforced determines which gaps exist. RBAC answers “may edit invoices”, not “this invoice”. See Access Control Models, Authorization Policy Engines.
Features that concentrate bugs:
| Feature | Why |
|---|---|
| PUT/PATCH/DELETE and read-shaped POSTs (CSV/XLSX export, PDF render, report generation, share-link creation, thumbnails, search) | written after the main read path; body IDs unchecked |
| Integrations, hooks, webhooks | foreign IDs attached to your account (Chatwoot inbox_id) |
| Membership, invite, role endpoints | cross-org role updates |
| Deprecated versions, admin AJAX, sidecars, reporting | outside the current authz layer |
| Auth providers called directly | Supabase /auth/v1/signup past a frontend domain check |
| Anonymous cloud identities | Cognito identity pool guest role allowed appsync:GraphQL on types/*/fields/* |
| Framework default routes | Rails ActiveStorage controllers are public by default |
| Agent tools, approval APIs | read-only roles reaching executing tools |
| Paths that never call the policy | CSV exports, search boxes, API resources that include relations, queued report jobs: Laravel PostPolicy guards update while the leak comes through a path that never calls authorize() (Canovas) |
| Search and filter parameters | wildcard terms match every record when results aren’t scoped to the caller (USPS, ~60M accounts) (USPS) |
| Token issuance for downstream systems | media/chat tokens minted by ID with no membership check; the app-level waiting room is bypassed at the media layer (Protocall) |
| Error and validation responses | denial bodies that serialize the object (HackerOne reference.json) |
Framework tells: AppSync/API Gateway IAM auth asks “may this principal call the API”, never “whose record”; that is the resolver’s job. Spring useSuffixPatternMatch, Next.js middleware-only auth, Supabase SECURITY DEFINER RPCs and service_role edge functions (RLS skipped), Rego policies without default allow = false.
ID leaks for later swaps: exports, notification emails, PDFs, JS bundles and source maps, logs, referrers, blog author links (PortSwigger GUID lab), shared AI chats, create responses that echo foreign names (Chatwoot turned its create endpoint into an inbox enumerator over sequential IDs), and lookup queries (checkUsername(email:) returning userId).
How to test
Map the surface. OpenAPI/Postman, JS bundles and source maps, mobile traffic, GraphQL introspection (Clairvoyance when off), old versions; kiterunner/ffuf for routes, Arjun for parameters. Include framework-convention routes that appear in no spec.
Build identities that own real objects. Minimum four contexts: A (victim, tenant 1), B (peer, same role, tenant 1), C (tenant 2), and a lower-privileged or anonymous context. Many apps check “same org” and stop, so the intra-tenant peer case is missed most often.
Build the matrix. Roles × functions (× data, per OWASP). Capture each request as the most-privileged or owning principal.
Core loop on every object-touching request: baseline 2xx as owner → replay with non-owner token and owner’s ID → diff status, body, length, headers, timing → re-read as owner to confirm state change.
Swap every ID location, including body IDs on writes (“authorizes path ID, acts on body ID”), child IDs in nested routes, mixed batches [own, victim, own] with the victim moved first and last, and every GraphQL path to the object in one aliased query.
Attack the lifecycle: revoke, remove, downgrade, soft-delete, then retry with retained IDs and tokens.
Cross the tenant line: membership IDs from tenant B with tenant A’s admin token; direct signup to “internal” tenants; shared-session replay across tenants, e.g. phpMyFAQ WebAuthn prepare() on tenant 1 then register on tenant 2 (CVE-2026-130369) (Multi-Tenant Isolation).
Read the errors. A uniform 401 wall can hide one handler with no auth filter: Devise’s “You need to sign in” is authentication; “Can’t verify CSRF token authenticity” on POST /rails/active_storage/direct_uploads meant the request had reached the controller. Check 403/404 consistency: /invoices/{id} 404 but /invoices/{id}/pdf 403 is an existence oracle.
Prove it. Fresh accounts, a unique marker in a newly created object, owner-verified writes, negative controls; replay against the other environment (staging-to-prod parity doubled impact in the exam-platform case).
Checklist:
Two users per role, two tenants, plus anonymous; token refresh automated (an expired 401 looks like a pass)
Every object-touching request replayed cross-user, cross-tenant, lower-role, unauthenticated
Bodies diffed, not just status (200 {"error":"forbidden"}, data in 302 bodies)
Writes/deletes verified by re-reading as owner; 403 that still mutates, fires a webhook or queues an email is a finding
False negatives ruled out: cached responses, soft-deleted/archived objects, 200 with empty body
Body, header, cookie, GraphQL, batch and nested-child IDs each swapped independently
Relay global IDs decoded, edited, re-encoded; root vs nested resolvers compared
Admin/deprecated/sidecar/framework-default routes hit with low-priv and no session
Revocation, role change and soft-delete retested with retained IDs
Agent tools exercised as a low-priv user, and with injected content naming another tenant’s object
Exploitation and escalation
Enumeration: sequential IDs plus a seed. The Cognito attacker turned emails into user IDs via checkUsername, then stepped ±1 around seeds: 401 IDs requested, 384 in 13 contiguous ranges, across eight guest identities. UUIDs don’t stop this once one leaks: one rigged response leaked more of the other account’s IDs, which opened a second route (Predictable Identifiers).
Read → takeover: profile/password endpoints on another user (IDOR to Account Takeover); leaked session values replayed (attempted, unsuccessful, in the Cognito case); Drupal GraphQL password change for any viewable account, including admins.
Horizontal → vertical: target an admin victim, then use their functions (PortSwigger myaccount?id=).
Role and claim tampering: cross-org PUT /api/memberships/{id} with role=Admin ($1,200 org takeover), JWT claim edits with algorithm confusion (JWT Algorithm Confusion), mass-assigned identity fields kept “verified” (Mass Assignment).
Function chaining: missing authz into a dangerous sink: Formie BFLA to Server-Side Template Injection, SGLang endpoint plus deserialization to RCE, Splunk sidecar to pre-auth RCE.
Agents: chat with an agent your role may execute; re-home a use-only credential to an attacker MCP server; approve other users’ agent commands. See AI Agent Authorization.
Business framing: a “$0” IDOR became a $12,500 P1 by chaining into workflow takeover and stating financial loss.
Bypassing defenses
Defense
Why it fails
Random UUIDs
a locator, not a control; leaked via author links, responses, logs, shares (PortSwigger lab; auto-financing drafts)
WAF / API gateway
a BOLA request is authenticated and well-formed; ownership lives in the DB. Gateway-only enforcement leaves service-to-service calls, jobs and queue consumers open
Hidden UI / client flags
USER_SIGNUP:false while /signup works; unmaskContactData=true boolean unlocked paywalled records
X-Original-URL, X-Forwarded-For: 127.0.0.1, Forwarded, path differentials; jhaddix’s list has 77 URL manipulations
Referer / Host / Origin checks
Volcengine TOS bucket opened with a target Referer ($6K); CircleCI MCP Host: localhost defeated by curl
Existence validation
exists:projects,id / FKs confirm the row exists, not who owns it
RLS
FK integrity checks bypass it; SECURITY DEFINER RPCs and service_role skip it; disabled RLS was only ~25% of Supabase findings
CSRF protection
not authentication: Rails hands any visitor a token on the public sign-in page
Role check
”is admin” ≠ “is admin of this org”; “same org” ≠ “same user”
Human approval
Loopjacking renders A and executes B; GhostApproval symlink makes the prompt show a workspace path
Policy engine
wrong inputs (client-supplied tenant as principal), or Rego semantics: undefined-as-false, deny not enforced on runtime error in the SPEF benchmark
Real-world cases
USPS Informed Visibility: wildcard search parameter returned and allowed modifying ~60M accounts; no per-caller scoping at all; reported a year before Krebs forced a fix (writeup).
Oracle E-Business Suite 12.2.3–12.2.15 (CVE-2026-114924 + CVE-2026-114925, both 9.8): function-authorization bypass in Application Object Library reaches REST functions with APPS privileges; chained with an unrestricted class-instantiation handler for unauthenticated OS command execution; fixed in the November 2026 CPU, no workaround (Horizon3).
HackerOne #3862641, $15,000: POST /reports/{id}/reference.json returned private report details in the error’s context.subject (oxo).
Protocall: any user minted a full LiveKit join token for any private or scheduled room by sequential room_id (room takeover); hidden, comments-disabled, blocked-user and deleted-post rules unenforced on per-post endpoints (post IDOR).
Freedit < 0.9.9 (CVE-2026-134678): Private-inn members overwrote any post, including moderator-locked ones (advisory).
Encrypted-ID oracle: a public EncodeString endpoint produced valid encrypted usernames for EncUserID, which returned PII, password fields, security questions and PINs (writeup).
Profile IDOR (CWE-639): /app-api/enduserapp/profile/{userId} returned any user’s PII, 200/404 oracle (writeup).
Novapay wallet (practice app): BFLA on /api/admin/users/{id}/role, invoice IDOR, and senderId in /api/transfer moving other users’ funds (writeup).
Peloton: unauthenticated user API “fixed” by requiring login only; any customer still read private profiles (writeup).
Cognito guest → AppSync BOLA: anonymous identity pool role, sequential IDs, 172 profiles, 60 with legacy session values; the same API would have allowed password changes (Exaforce).
Chatwoot v4.19.1: Current.account.hooks.create!(permitted_params) with unchecked inbox_id; invisible hook forces a victim tenant’s conversations to pending; CVSS 6.6, CWE-639/863, no CVE (Abraxas).
Frappe 8.8.0–<16.30.0 (CVE-2026-134371): any Contact’s phone numbers via get_contact_number (GHSA).
Drupal graphql_core_schema < 1.0.29 (CVE-2026-126725, SA-CONTRIB-2026-316): with User Login extension enabled, anyone who can view an account can change its password (writeup).
graphql-ruby Execution::Next: class-level .authorized? skipped on resolvers/mutations (advisory); GHSL-2026-152 resolved after authorized? raised (GHSL).
Laravel API white-box: four PUT/PATCH routes accepted foreign body IDs; three echoed the other account’s data, one moved the object across accounts (jrobineau).
Auto-financing drafts: guest login read/updated/attached/deleted files on another identity’s KYC draft (DOB, IBAN, payroll, ID files) (SiteGuarding).
University exam SaaS: unauthenticated ActiveStorage direct upload + presigned S3 PUT + public serving on prod, CWE-306, Medium (writeup).
PortSwigger GUID lab: victim GUID harvested from blog author link, swapped into /my-account?id= for their API key (walkthrough).
Next.js CVE-2025-29927: one header skipped middleware auth on self-hosted Next.js (Snyk).
n8n (CVE-2026-65015, CVE-2026-59207): Viewer executes via project agent; use-only credential leaked through MCP header auth (deturris).
Pulse (CVE-2026-129428): viewers approve others’ AI command requests (advisory).
LiteLLM (CVE-2026-59822, KEV): any Bearer token made a valid MCP session (Wiz).
Keycloak Fine-Grained Admin Permissions (GHSA-g8fg-4fv8-5mjx): incomplete fix of an earlier flaw; a group admin barred from a sub-group moves it to the top level, escapes the restriction, and controls its members → possible realm takeover (advisory). See Privilege Escalation.
Open5GS WebUI ≤ 2.8.0 (CVE-2026-135691): webui/server/routes/db.js let user-role accounts PATCH /api/db/Account/, setting roles to admin, overwriting or reading password hashes and deleting accounts (advisory). See Privilege Escalation.
rConfig Core 8.1.0–8.2.19 / Pro < 8.4.0 (CVE-2026-135694): ExportController::export($table) enforced an EXCLUDED_TABLES deny list that authenticated users bypassed by naming excluded tables → decrypted passwords, device credentials, API tokens (advisory); the users API let any authenticated user reset an admin’s password by id (CVE-2026-135695) (advisory). See Function Level Authorization, IDOR to Account Takeover.
DreameHome cloud API < 2026-10-14: caller-supplied uid/device DID minted another user’s Meari camera session or Agora RTC token (CVE-2026-49964) (Meari, RTC). See BOLA in APIs.
EUSurvey ≤ 1.6: unauthenticated sequential-ID reads of private survey responses through a PDF handler that skipped access checks (advisory). See Predictable Identifiers.
Microsoft Clarity (CVE-2026-113824, critical): authorization bypass through a user-controlled key, network privilege elevation; no detail published (advisory).
Bolt < 6.1.4 (CVE-2026-77379): the public Relation API (REST and GraphQL) lacked the access-control filter, so unauthenticated users enumerated metadata of unpublished, draft and viewless content (advisory).
ArcadeDB < 26.11.1 (CVE-2026-134327): per-type ACLs were ignored by listings, so authenticated users read schema of denied types (properties, indexes, inheritance, materialized-view SQL) via the PostgreSQL wire catalog, GraphQL introspection or MCP get_schema (advisory). Every metadata path needs the same ACL as the data path.
Microsoft Entra Connect Health API (exploited Jul 23–Nov 9, 2026): unauthorized read-only access to tenant metadata (technical-contact emails, tenant ID and name, initial domain, license tier, sync status); service-side fix Nov 19, no CVE at disclosure. Main follow-on risk is targeted admin phishing; Microsoft recommends phishing-resistant MFA and PIM for contacts holding privileged roles (Help Net Security). See Multi-Tenant Isolation.
Zimbra 10.1.16 SaveDraftRequest (CVE-2026-73571): an ordinary user sent mail as another local mailbox with no delegation grant, landing the message in the victim’s Sent folder; Metasploit admin/http/zimbra_email_impersonation (Rapid7).
Sub-account self-escalation (hosting platform, P4 dup): a sub-user granted only “View & Manage Contacts” could edit their own permission set in the normal UI and grant themselves admin-equivalent rights; the admin was never notified (writeup). See Privilege Escalation.
GraphQL BOLA methodology: two controlled accounts, swap the ID, prove with a redacted response; fix with a per-resolver ownership check, not endpoint authentication (securityelites). See BOLA in APIs.
Prevention
Architecture
Deny by default; one enforcement mechanism on every entry point (REST, GraphQL resolvers, AJAX, gRPC, sidecars, jobs, queue consumers, agent tools). A route with no policy fails closed; lint for handlers missing the decorator.
PEP/PDP split: a Policy Enforcement Point in shared middleware or the data-access layer asks one question, “may this subject do this action on this resource in this context?” (Authorization Policy Engines).
Subject from the verified token (sub), never from a client user_id, tenant header or unchecked subdomain. Scope role checks to the resource’s org: isAdmin(user, resource.org), with a hierarchy so actors can’t modify principals at or above their level.
Model choice: RBAC for coarse function gates, ABAC/ReBAC for object and tenant scope (OWASP recommends ABAC/ReBAC over RBAC for object-level rules). Attribute and tuple write access is itself privilege (Access Control Models).
Make the unscoped query hard to write
current_user.orders.find(id) instead of Order.find(id); repository methods that can’t be called without a subject or tenant argument.
Check the owner of every received ID in the same statement as the write; return the same not-found for missing and foreign:
UPDATE documents d SET project_id = p.id FROM projects pWHERE d.id = $1 AND d.owner_id = $3 AND p.id = $2 AND p.owner_id = $3
Laravel: Rule::exists('projects','id')->where('owner_id', $userId). Drop fields the product never needs to change (that’s BOPLA, not BOLA).
Back it in the schema with a composite FK, so the DB rejects cross-owner links even if code forgets:
(Doesn’t cover ownership via a parent.) After fixing, query for cross-account links already written.
Tenancy in the data layer with Postgres RLS (AS RESTRICTIVE ... USING (tenant_id = current_setting('app.tenant_id', true))), plus review of service_role, SECURITY DEFINER and open signup (Multi-Tenant Isolation).
Framework controls: Spring Security AuthorizationManager, ASP.NET Core resource-based IAuthorizationHandler, Pundit/CanCanCan, DRF get_queryset + django-guardian, NestJS guards + CASL; OPA, Cedar, OpenFGA/SpiceDB, Cerbos or Casbin when sharing and delegation outgrow framework code. Override unsafe defaults: Rails warns all ActiveStorage controllers are public unless you implement authenticated controllers.
Cover the non-policy paths: exports, search, serialized relations and background jobs need the same scoping as the detail endpoint; review list and bulk paths, not just update (Canovas). Scope search results to the caller and reject match-all terms (USPS).
Lifecycle and responses: propagate revocation, deletion and role change synchronously (or carry consistency tokens such as Zanzibar zookies against the new-enemy problem); consistent 403 vs 404 with no leak via body, headers, error text or timing; exit safely (no data in redirect bodies).
Edge: strip X-Forwarded-*, Forwarded, X-Original-URL, X-Rewrite-URL, x-middleware-subrequest inbound; one shared path normalizer for gate and router (Header-Based Access Control Bypass).
Agents: authorize every tool call against the end user (effective rights = agent ∩ user), propagate identity with OAuth On-Behalf-Of, treat tool arguments as untrusted, bind credential restrictions to the credential, bind approvals to exactly what executes (AI Agent Authorization).
Policy engines:default allow = false in Rego and a test that deny holds on evaluation errors; restrict built-ins (http.send) via OPA capabilities; protect bundle sources and tuple stores as tier-0.
Verification and detection: per endpoint a positive owner test and a negative A-requests-B test (writes re-read as owner), skeletons generated from OpenAPI, build fails when a route ships without one; RED→GREEN→STABLE regressions (ExploitSpec). Log every decision (subject, object type/ID, action, result, request ID) and alert on per-session denial spikes and on one subject touching an unusual number of distinct object IDs, the enumeration signature.
Tools
Tool
Use
Autorize (Burp)
shadow-replay every proxied request with a low-priv/no session; tune enforcement detectors
AuthMatrix, Permitter (Burp)
explicit users × roles × requests matrix; replay history across roles
Auth Analyzer (Burp), Caido match-and-replace
parallel sessions with per-session CSRF extraction; ID/token swaps
Session Switcher (Burp)
one-click session swap in Repeater
ReproCase
executable case files with fresh accounts and a marker; verdicts reproduced / not_reproduced / inconclusive (expired session can’t pass as fixed); supports writes, role checks, CORS private reads