Second-Order and Multi-Step IDOR

IDORs where the foreign reference isn’t used in the request that carries it. It’s stored in session, workflow state, a schedule or a share, or it’s honoured only at a later step. The object-level check happens (or is skipped) somewhere a single-request swap test never looks.

How it works

Classic IDOR testing replays one request with a swapped ID. These variants break that model in three ways:

VariantMechanism
Second-orderinput is stored first, then later used to reference an object without re-checking ownership ([[raw/intigriti.com/idor-a-complete-guide-to-exploiting-advanced-idor-vulnerabilities-inti-2796
Multi-stepearly steps of a workflow are checked; a later step (review/submit/finalize) isn’t ([[raw/weekly-bugbounty-content.beehiiv.com/broken-access-control-advanced-idor-exploitation-4163
Grant-lifetimeaccess was legitimate when granted but isn’t re-evaluated after revocation
Reference leak across boundarya reference legitimately visible in one context is accepted by another endpoint with a stronger permission

IDORs persist because ownership assumptions get reused across steps that weren’t designed to connect (Aikido).

Techniques / patterns

Stored reference trusted later

  • Scheduled export: the schedule stores a user ID in an external scheduler; when it fires, it reads the ID from metadata and generates the export with no fresh check, so you can schedule an export of another account (Intigriti).
  • Session seeded with a foreign ID (Bookly ≤28.2, CVE-2026-93399): the unauthenticated bookly_get_form_id accepted an order_id and persisted it into a new booking session without proving that session created the order. A later action (bookly_render_complete) then disclosed the victim order’s secret bookly_order token. The token unlocked bookly_add_to_calendar (disclosure) and bookly_rollback_order (deletion of unpaid bookings). The non-sequential token was meant to be the boundary; the session bridged the predictable ID to it (Sentrium).
  • Internal API path injection: a front API reflected the user ID unvalidated into the path of an internal-only request; traversal (../<otherId>) fetched another user’s data, and the internal API didn’t receive the auth header. One endpoint did this; siblings URL-encoded first (Weekly Bug Bounty).
  • Attach-to-own-object: Habitat ≤1.7.1 (CVE-2026-130859) let CreatePostController::addAttachmentsToPost() claim other users’ unposted uploads by sequential attachmentId, publishing them and removing them from the owner’s draft (Habitat). Same shape as body foreign-key BOLA in BOLA in APIs.

Workflow position

  • Job application: autosave and submit are checked; the final review/submit endpoint isn’t (Weekly Bug Bounty).
  • 5-step memorial wizard with enumerable step IDs, plus a backend that accepted the literal CSRF placeholder → anonymous hijack (bblabs Wizard Takeover).
  • Write-then-read sequences: KYC financing drafts allowed cross-identity read, update, file attach/delete; submit reached the other draft’s business rules. Scanners miss this because it needs two sessions and a write followed by a read (SiteGuarding).

Grant lifetime and derived access

  • Frappe Document Follow (CVE-2026-66000/66058/66059): three failures. Follow any document (object level), receive fields you can’t read (field level), and keep getting change emails after permission is revoked (grant lifetime). Fixed in Frappe v16.23.0 / v15.112.0 (Robin Roy).
  • Removed member keeps reading: a page ID captured while a member still returned private metadata and the member list after removal (The User Was Removed).
  • Shared container → private child: a shared AI chat exposed a private skill UUID, and a secondary POST /skills/{uuid}/diagram returned its instructions (shared AI chat); see IDOR in AI Applications.
  • Parent/child mismatch: GROWI checked the page but not that the revision belonged to it (GROWI); TeamPass update_folder checked neither target nor new parent folder, allowing re-parenting of credential subtrees (TeamPass).

Stale state in the check itself

Provenance Blockchain’s AddAccess let a caller who “controls 100% of supply” administer a marker, but read the supply from the marker struct, which stays 0 for non-fixed markers while the bank module holds the real count. Anyone could become admin of 82 live markers before v1.28.0 (Trail of Bits). The check ran, but against divergent state.

Testing

  • Follow every ID through the whole workflow: where it’s stored, which later actions consume it, which tokens or secrets it unlocks.
  • Swap IDs at every step, especially final/review/confirm and async consumers (exports, schedules, webhooks, notifications).
  • Re-test with captured IDs after revocation, downgrade, removal from org, and after share links are disabled.
  • For parent/child routes, pair your parent with a foreign child and a foreign parent with your child.

Defenses

  • Keep workflow identifiers in server-side session state rather than client parameters (OWASP IDOR Cheat Sheet).
  • Re-authorize at consumption time (job execution, notification dispatch, final submit), not only at creation.
  • Bind child objects to parents in the lookup (WHERE revision.page_id = :page).
  • Make revocation invalidate derived grants (follows, subscriptions, cached share access).
  • Evaluate authorization against the authoritative source of truth, not a cached or denormalized field (Trail of Bits).

Sources