Home / patterns

IDOR in vibe-coded apps: changing an ID in the URL to see someone else's data

A developer looking worried at a laptop browser URL bar with a numeric user id highlighted, with two different printed user profile cards on the desk
Quick answer: AI coding tools often generate routes like /orders/123 or /users/45 that look up a record by an ID from the URL. If the server returns that record without checking that it belongs to the signed-in user, anyone who is logged in can change the number and read or change someone else's data. That pattern is called insecure direct object reference (IDOR), and MITRE tracks the core issue as CWE-639.

Last updated November 11, 2026

Steps

  1. Search your generated app for routes and API handlers that take an id, uuid, slug or filename from the URL, query string, hidden form field or JSON body.
  2. For each one, open the server code that loads the record. Confirm it checks ownership or permission against the authenticated user from the session or token, not from a client-supplied userId field.
  3. Prefer scoped lookups such as "find this order where id = X and owner = currentUser" instead of "find order X" alone.
  4. Stop trusting a userId (or role) sent from the browser. Take the user identity only from your auth layer after verification.
  5. As defense in depth, prefer opaque IDs (UUIDs) over sequential integers, but still enforce object-level checks—unguessable IDs are not a substitute for authorization.
  6. Test while logged in as user A: copy an object ID that belongs to user B into the URL or request body and confirm the server returns 403 or 404, not B's data.
  7. Repeat the swap test for read, update, delete and export endpoints that accept object references.

Why it matters

MITRE CWE-639 (Authorization Bypass Through User-Controlled Key) describes systems that let one user reach another user's record by changing the key that identifies it. Common consequences include bypassing access control and horizontal privilege escalation. OWASP's IDOR prevention cheat sheet says an IDOR needs an object, a reference to it, and a missing object-level authorization check, and that complex IDs still need access control if someone obtains another user's URL.

Sources

MITRE CWE-639: Authorization Bypass Through User-Controlled Key — https://cwe.mitre.org/data/definitions/639.html

OWASP Cheat Sheet: Insecure Direct Object Reference Prevention — https://cheatsheetseries.owasp.org/cheatsheets/Insecure_Direct_Object_Reference_Prevention_Cheat_Sheet.html

Checked at the source on November 3, 2026.

Related patterns

Found a problem you'd rather not fix yourself?

Tell us what's wrong. A StorenTech engineer reviews your app and replies with a fixed quote, so you know the cost before any work starts.

Get it fixed by StorenTech

Vibe Security Weekly

One email a week with new failure patterns and how to fix them.

By joining you agree we may email you this newsletter. See our privacy policy. Free. Unsubscribe anytime. We'll never sell your email.