Finding vulnerabilities

IDOR

Insecure direct object references — when an app trusts an ID and forgets the ownership check.

intro tutorial

IDOR (Insecure Direct Object Reference) is an access-control flaw: the app exposes a reference to an object — a row, a file, a user — and fails to verify the requester is allowed to access it.

Spot the pattern

Anywhere an identifier appears in a request, ask “what if I change it?”

The request
GET /api/invoices/1043 HTTP/1.1
Cookie: session=<your-session>
The probe — same session, a different ID
GET /api/invoices/1042 HTTP/1.1
Cookie: session=<your-session>

If the second request returns someone else’s invoice, the endpoint trusts the ID without an ownership check.

Where to look

  • Numeric IDs in paths/queries (?id=, /users/42).
  • IDs in JSON bodies, including nested ones.
  • Filenames in download/export endpoints.
  • IDs in hidden fields and API responses you can replay.

The fix

Authorize every request server-side, scoped to the authenticated user:

Authorize at the data layer
SELECT * FROM invoices WHERE id = ? AND owner_id = :current_user;