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

Last updated November 11, 2026
Steps
- 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.
- 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.
- Prefer scoped lookups such as "find this order where id = X and owner = currentUser" instead of "find order X" alone.
- Stop trusting a userId (or role) sent from the browser. Take the user identity only from your auth layer after verification.
- 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.
- 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.
- 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
- API routes with no auth check
- Mass assignment: users can set fields like role or is_admin
- Auth checked only in Next.js middleware (proxy)
- Sessions that stay valid after logout, password change or timeout
- Race conditions let one coupon, gift card or credit be used twice
- API responses that return whole database records (excessive data exposure)
- GraphQL APIs with introspection on and no depth or cost limits
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 StorenTechVibe 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.