Web SecurityWeb Security · Lesson 07

Broken Access Control & IDOR

Horizontal and vertical privilege escalation, and server-side checks.

Video tutorialTrack course · freeCodeCamp
Speed
Next lesson
Watch 00:00 · 2 checkpoints Watch on YouTube More on this topic
Transcript & captions
10/10

Broken access control is the number one item on the OWASP Top 10. IDOR (Insecure Direct Object Reference) is its most common form: change an id in a request and read someone else's data.

IDORjs
GET /api/invoices/1042   -> your invoice
GET /api/invoices/1041   -> someone else's invoice

// FIX: scope every query to the caller
select().eq('id', id).eq('owner_id', session.userId);
  • Horizontal escalation: reach another user's data at the same level.
  • Vertical escalation: reach admin-only functionality.
  • Hidden admin routes are not access control - enforce on the server.
  • Check authorisation on every request, not just on page load.
  • Deny by default; allow explicitly per role and per resource owner.

In a database with row level security, write policies that scope rows to the authenticated user, and never decide privilege from client-supplied values.

Knowledge check

0/2 answered

Changing an id in a URL to read another user's record is...

Hiding an admin link in the UI is...