Insecure Direct Object Reference

The server resolves an object from a client-controlled reference (ID, UUID, filename, token, slug) and acts on it without deciding whether the authenticated subject may perform that action on that specific object. CWE-639, under OWASP A01:2025 Broken Access Control, and API1 (BOLA) in the API Top 10.

What it is

OWASP lists three ingredients: an object (account, document, ticket, transaction), a reference to it (ID, UUID, account number, token, slug, filename), and a missing object-level authorization check (OWASP IDOR Cheat Sheet, OWASP). The trust boundary that breaks is between who you are and what this object is. Authentication succeeds and the route-level role check passes, but nobody asks “is invoice 1002 yours?” MDN’s Express example shows the canonical bug: the handler checks req.isAuthenticated() but not req.session.userId === req.params.id (MDN).

The name points at the wrong fix. “Direct reference” suggests making references indirect or unguessable. The defect is the missing subject→object decision, and a UUID in the path doesn’t change whether that decision happens (agentoffense, /me/ endpoints). The bug persists because authorization is applied per route while each object read/write needs its own decision. Find-by-id ORMs (Order.find(params[:id])) make the unscoped query the default, and ownership assumptions get reused across workflow steps that weren’t designed together (Aikido).

Axes (PortSwigger):

  • Horizontal: same role, another user’s object. The classic IDOR.
  • Vertical: lower-privileged principal reaches a higher-privileged object. This overlaps Function Level Authorization.
  • Cross-tenant: another organization’s object. See Multi-Tenant Isolation.

Why it matters

Impact ladder, low → high:

  1. Metadata / existence oracle: 403-vs-404 differences reveal which IDs exist.
  2. Single-record read: profile, order, receipt (Directorist receipts).
  3. Mass PII enumeration: sequential IDs mean the whole table. An HR endpoint returned a full employee directory with tax IDs (CVSS 9.8) (employee directory). Medical records via document IDs (CVE-2026-103089) (patient records).
  4. Integrity: edit or delete others’ objects. Snapchat Spotlight deletion paid $15,000 (Snapchat); Facebook album deletion paid $12,500 (Facebook album); LatePoint transaction modification (LatePoint).
  5. Availability across tenants: Cube Studio users could delete other tenants’ inference pods (Cube Studio).
  6. Credential / account takeover: password, email, PATs, passkeys, IMAP passwords. See IDOR to Account Takeover.
  7. Privilege escalation: editing another tenant’s permission scopes (GraphQL org check), or a teacher resetting admin passwords (openSIS).

Severity drivers: ID reachability (sequential vs leaked vs unguessable), authentication requirement, read vs write, data class (PII/KYC/medical/credentials), blast radius (one row vs table vs tenant). Payout tracks demonstrated business impact, not CVSS. A GraphQL alias DoS paid $12,500, while an IDOR exposing every user’s profile (CVSS 7.1) was triaged Informative in 2021, was still exploitable in 2025, and paid $0 as a duplicate ($0 IDOR). Prevalence: one tracker counts 143 IDOR reports/writeups from 2024–2026, 34 rated High or Critical (SecureHyperloop); IDOR was the most common class in Max’s bug bounty program (213 flaws) (Max BB).

How it works

VariantMechanismPage
Classic parameter swap?id=1001 → 1002; path, query, body, header, cookieIDOR Testing Methodology
API object-level (BOLA)route authorized, object not; path vs body ID; GraphQL multi-path resolvers; batch itemsBOLA in APIs
Predictable / leaked referencessequential ints, ObjectId, encoded ints, v1 UUIDs, Relay IDs; UUIDs harvested from share links and oraclesPredictable Identifiers
Second-order / multi-stepstored ID trusted later; final workflow step unchecked; grants outlive revocationSecond-Order and Multi-Step IDOR
Static-file reference/static/12144.txt chat transcripts with incrementing filenames ([[raw/portswigger.net/idor-portswigger-web-security-2730PortSwigger]]); CVE-2023-4836 WordPress User Private Files ([[raw/hadrian.io/insecure-direct-object-reference-idor-a-deep-dive-3069
AI-object IDORconversations, prompt revisions, skills, memory/RAG refs; agent confused deputyIDOR in AI Applications
Account takeoveridentity/credential objects referenced by client IDIDOR to Account Takeover

Where to find it

  • Endpoints: anything with id, uid, pid, *_id, uuid, sn, slug, filename, in params, headers and cookies too (Bugcrowd). User-scoped nouns are the best start: /users/<id>/creditcard/details (Aon).
  • Features: exports (CSV/XLSX/PDF), report generation, share links, invites, attachments, comments, wishlists, bookings/checkouts, payments/refunds, follow/subscribe, integrations/webhooks, draft autosave, “mark as read” (agentoffense, Intigriti).
  • Code smells: Model.find(params[:id]); exists: validation without owner; UPDATE … WHERE id=? without tenant; base model without user_id (Nginx UI CVE-2026-33030); a read helper reused for delete (Vikunja CVE-2026-33312); one resolver in a family missing the check (EveryDocs, jrobineau, Meteroid, Nginx UI, Vikunja).
  • Platforms: WordPress AJAX/REST handlers missing current_user_can('edit_post', $post_id) (TaxoPress CVE-2025-14371) (TaxoPress); LearnPress Wishlist exposes user_id through a REST route guarded only by a public wp_rest nonce (LearnPress).
  • Hidden surfaces: undocumented RPC (Google batchexecute) (Google Classroom), deprecated endpoints (Fleet), documented-but-unused API routes (The User Was Removed), internal APIs exposed through mined keys (Brutecat/Google).

How to test

  1. Identities: A (victim) and B (peer, same tenant), C (other tenant), D (low-priv/unauth), plus a revoked identity, each owning real objects.
  2. Map the object model: OpenAPI, Postman, JS bundles, mobile traffic, GraphQL schema, archived versions. Log every ID that appears.
  3. Core loop: owner baseline → replay with non-owner token + owner’s ID → diff status/body/length/headers/timing → re-read as owner.
  4. Swap each ID location independently: path, query, body, foreign keys in body, headers, cookies, GraphQL vars, batch elements.
  5. Mutate request shape: HPP, JSON arrays/objects/wildcards, method and content-type swaps, old API versions, me → numeric ID.
  6. Chase reachability: decode encoded IDs and harvest UUIDs from share links, errors and public profiles (Predictable Identifiers).
  7. Follow IDs through workflows: later steps, async jobs, revocation (Second-Order and Multi-Step IDOR).
  8. Prove minimally: own accounts only, empty test objects, a reproducible request pair.

Full loop, evidence rules and tooling are in IDOR Testing Methodology.

Checklist

  • Horizontal, cross-tenant, vertical and post-revocation contexts
  • Read, update, delete, export, share, admin operations per object
  • Body/foreign IDs on writes, not only path IDs
  • GraphQL: every resolver path to each type (node, typed, traversal, mutation payloads)
  • Batch: victim at first/middle/last position; partial success
  • Nested routes: own parent + foreign child
  • 403/404/timing parity between sibling routes
  • Cache, soft-delete, expired-token false negatives excluded

Exploitation and escalation

  • Enumeration at scale: sequential or derivable IDs turn one bug into a full dump (Predictable Identifiers).
  • Write IDORs → integrity/availability: deletions, re-parenting credential folders (TeamPass) (TeamPass), cancelling other events’ attendees (Attendize CVE-2026-132773) (Attendize), messaging another account’s attendees for phishing (CVE-2026-132774) (Attendize).
  • Credential objects → ATO: see IDOR to Account Takeover.
  • Tenant boundary → Multi-Tenant Isolation failure: ZITADEL CVE-2025-64431, MailWatch CVE-2026-85749, Chatwoot cross-tenant hooks (ZITADEL, MailWatch, Chatwoot).
  • Chaining: a CL.TE request-smuggling desync turned a harmless IDOR into adding data to a victim’s account (/addCard) (Hipotermia); IDOR + CSRF (bblabs). See Vulnerability Chaining.
  • Business-logic framing: tie the bug to money or workflow takeover. Billing-arrangement modification in a payment extension API (payment extension); the “$0 vs $12,500” lesson (business logic matters).

Bypassing defenses

DefenseWhy it fails
UUIDs / “unguessable” IDsleaked via share links, author pages, errors, other responses ([[raw/sagar-bhattarai.github.io/portswigger-user-id-controlled-by-request-parameter-unpredictable-ids-12599
Encoded / “opaque” tokensbase64 JSON {"user_id":…,"report_id":…} with no signature ([[raw/medium.com/idor-in-the-medical-report-viewer-13543
Path-ID check onlybody/foreign IDs validated for existence only; Postgres FK checks bypass RLS ([[raw/jrobineau.com/bola-your-api-checks-the-url-but-misses-ids-in-the-json-body-15618
Check on one resolver/version/methodGraphQL node path, /v1, POST/alt content-type unprotected ([[raw/dev.to/graphql-bola-one-object-many-paths-and-how-to-prove-the-gap-14345
Input-shape validationarrays, nested objects, wildcards, padded/negative/decimal IDs, HPP ([[raw/weekly-bugbounty-content.beehiiv.com/broken-access-control-advanced-idor-exploitation-4163
Encrypted IDsthe app exposes its own encoder: POST …/EncodeString encrypts any username, and /api/v1/application/EncUserID returns the matching account (PII, password-related fields, security questions, PINs) ([[raw/d0loreh4z3.medium.com/encrypted-id-s-no-problem-15808
Deny-but-describethe 403/422 path still serializes the object: HackerOne’s /reports/{id}/reference.json returned private report details in context.subject of the error ([[raw/oxo.is/idor-allows-user-to-access-report-details-via-reference-json-endpoint-15811
Visibility filter on listings onlyhidden posts drop out of feeds, but per-object endpoints and a post_id parameter on the listing call return them; blocks, allow_comments=false and soft-deletes are not enforced either ([[raw/community.protocall.ch/post-idor-hidden-posts-readable-by-id-listing-filter-bypass-15812
Signed URLsprove integrity and expiry, not authorization ([[raw/medium.com/laravel-temporary-signed-urls-invalid-signature-expiry-and-idor-14774
App-capability tokenscheck the app’s capability, not the user’s ownership (Facebook album) ([[raw/masimshahzad.medium.com/facebook-idor-deleting-any-photo-album-case-study-15023
WAF / gateway / rate limitrequests are authenticated and well-formed; ownership lives in the DB; aliases and batches beat per-request limits ([[raw/sycope.com/idor-vulnerability-detection-through-http-traffic-analysis-4162

Real-world cases

  • HackerOne — POST /reports/{id}/reference.json with {} leaked private report details in the error body, $15,000, H1 #3862641 (oxo).
  • Protocall — POST /api/room/token/user {"room_id":2716} minted a full LiveKit join JWT (roomJoin, roomCreate, 5 h) for any private or scheduled room; the waiting room said “not allowed” while media already flowed; distinct room_was_finished/room_not_found errors mapped every room (room takeover). Hidden, comments-disabled and deleted posts were readable and commentable by ID (post IDOR).
  • Freedit < 0.9.9 (CVE-2026-134678) — POST /post/edit/:pid skipped ownership and lock checks for Private-inn posts; members overwrote any post by sequential ID and re-attributed it (advisory).
  • /app-api/enduserapp/profile/{userId} — authentication without authorization returned any user’s profile PII (CWE-639); 200 vs 404 userNotFound doubled as an enumeration oracle (writeup).
  • Novapay wallet (practice app) — POST /api/transfer trusted body senderId, so funds moved out of other accounts; invoices readable by ID (writeup).
  • Snapchat — DeleteStorySnaps(ids:) deleted any Spotlight, $15,000, H1 #1819832 (oxo, HackerOne).
  • Facebook — any visible album deletable via Graph API with a first-party token, $12,500 (2015) (case study, four lines); editing friends’ post dates, $538 (timeline date).
  • Meta AI — near-sequential prompt-revision IDs exposed others’ prompts and outputs, $10,000 (Meta AI).
  • Google — Classroom batchexecute submission-ID IDOR (Classroom); Brutecat’s AI-driven internal-API sweep, >$500k (Cyberkendra).
  • Rocket.Chat — unauthenticated file read via Livechat token + ObjectId prediction, H1 #3687142 (Aikido).
  • Featurebase — client-asserted userId → ATO across many programs’ feedback portals (Featurebase).
  • Bookly CVE-2026-93399 — unauthenticated order-ID → token → booking disclosure/deletion, 60k+ installs (Sentrium).
  • Foreman CVE-2026-86322 — forge PATs for any user (Foreman).
  • Frappe/ERPNext CVE-2026-66000/66058/66059 — Document Follow object/field/lifetime failures (Robin Roy).
  • Xibo CVE-2026-50542 / CVE-2026-52729 — layout status read; action PUT/DELETE without ACL (Xibo read, Xibo write).
  • Tutor LMS GHSA-c873-m8w7-q26f — subscriber reads paid content, quiz keys, admin PII (Tutor LMS); Academy LMS cross-student quiz answers (Academy LMS).
  • VitaFit CVE-2026-54377 — predictable IDs + account enumeration → body-composition reports (VitaFit).
  • Head Start TTADP — cross-region read/write (GHSA-9r9x-g862-525c, GHSA-q859-79hf-rpr3) (r3vpwnx).
  • CommCare formplayer GHSA-qjg7-cgv8-3c43 — cross-project form sessions; fixed with @ValidateSessionOwner (CommCare).
  • School admissions — /print-form.php?app_number= exposed admission PII (admissions).
  • DreameHome cloud API < 2026-10-14 — POST /smart-app/meari-cloud/redirectAndLogin selected the Meari camera account from a caller-supplied uid without matching it to the Dreame-Auth token, handing over the victim’s Meari identity and session (live video, mic audio, speaker, recordings); uids came from public forum profiles and an email-to-uid lookup (GHSA-7mmp-qpv4-2q5v). POST /dreame-user-iot/token/rtc2 (CVE-2026-49964) issued an Agora RTC token for any device DID + owner UID, letting the attacker join and publish into the device’s live-video channel (GHSA-3pfg-cg22-v3rr). See IDOR to Account Takeover.
  • EUSurvey ≤ 1.6 (GHSA-x6m3-wr5v-92pc) — GET /preparepublishedcontribution/{id} (contribution PDF handler) looked up responses by sequential DB ID and skipped the normal access checks; unauthenticated enumeration of private survey answers (advisory). See Predictable Identifiers.
  • rConfig Core 8.0.0–8.2.12 / Pro < 8.4.0 (CVE-2026-135695) — UserController::update accepted any user id, so an authenticated user set an administrator’s password and logged in as them (advisory). See IDOR to Account Takeover.
  • Microsoft Clarity (CVE-2026-113824, critical) — CWE-639 authorization bypass through a user-controlled key allowing network privilege elevation; advisory gives no further detail (advisory).

Prevention

  • Scope every lookup to the subject. Rails: @current_user.projects.find(params[:id]), not Project.find(params[:id]) (OWASP IDOR Cheat Sheet). Make the unscoped query hard to write: repository methods that require a subject/tenant argument, backed by RLS (agentoffense).
  • Subject from the session/token only. Never trust a client user_id, tenant header or unverified subdomain. Keep multi-step identifiers in the session (OWASP, APISecurity.io).
  • Validate every received ID for existence and ownership in the same query, including foreign keys in bodies. RLS doesn’t cover FK writes (jrobineau).
  • Central PEP/PDP, default deny: framework-native (Spring AuthorizationManager, ASP.NET IAuthorizationHandler, Pundit/CanCanCan, DRF get_queryset + django-guardian, NestJS + CASL) or a policy engine (OPA, Cedar, OpenFGA/SpiceDB, Cerbos, Casbin) (agentoffense). See Authorization Policy Engines.
  • GraphQL: authorize in the business layer so node, typed and nested paths share one decision (GraphQL BOLA).
  • Random public IDs (UUIDv4/128-bit) as defense in depth only. Don’t put object IDs in unsigned client tokens (OWASP, medical report viewer).
  • Authorize before you load-and-serialize. Denial and validation errors must not echo the object (oxo). Apply visibility rules (hidden, blocked, deleted, comments-off) in the shared object loader, not only in list queries (Protocall). Gate token issuance for downstream systems (media, chat) on membership (Protocall rooms).
  • Consistent denial: pick 403 or 404 and apply it everywhere, with no error-text or timing differences (agentoffense).
  • CI negative tests: persona A requests persona B’s object for every object-touching endpoint, and writes are re-read (ExploitSpec). See Authorization Testing Automation.
  • Detection: alert on per-session 401/403 spikes and sequential ID walks. WAF signatures won’t see IDOR (Sycope).

Tools

Burp Autorize, AuthMatrix, Auth Analyzer, Session Switcher (Doyensec), Burp Intruder / ffuf for ID sweeps, IDOR-Scanner (IDOR-Scanner), IDOR-Forge (IDOR-Forge), ReproCase (ReproCase), ExploitSpec, PwnFox (container tabs per identity), InQL / Clairvoyance / graphw00f for GraphQL, kiterunner / Arjun for route and parameter discovery, CyberChef for decoding IDs. See Burp Suite Extensions.

Sub-pages

Related elsewhere: Broken Access Control, Function Level Authorization, Multi-Tenant Isolation, Authorization Testing Automation, Privilege Escalation, Mass Assignment, GraphQL Authorization Flaws, OWASP API Security Top 10, Account Takeover, Authorization Security, API Security.

Sources