Broken Access Control and IDOR
Chapters and transcript
Broken Access Control The OWASP Top 10 is a widely used list of the most critical web application risks. In its latest editions, Broken Access Control is at number one. It means a user can reach data or actions that are not theirs, like other customers' records. Let us see how it happens, and how to stop it.
Two easy words Two words are easy to confuse. Authentication asks, who are you? That is logging in. Authorisation asks, what are you allowed to do? That is permissions. Many websites do authentication well, then forget to check authorisation on every request.
What is IDOR? One common form has a name: IDOR. It stands for Insecure Direct Object Reference. It means the server fetches a record by its ID, without checking who owns it. For example, you change invoice ten forty-two to ten forty-one. And IDs can appear in the URL, form data, API requests or cookies, so testers look everywhere.
What is IDOR? Watch it on the network. You ask for your own invoice, ten forty-two. That is fine. Now you change the ID to ten forty-one. The server fetches it from the database, but it never checks the owner. And someone else's invoice comes back to you.
IDOR in action Now on the laptop, in the practice lab. I open my own invoice, number ten forty-two. Look at the address bar. I change the ID to ten forty-one, and load the page. This invoice belongs to another customer. The server never checked the owner. That is IDOR.
Admin pages Here is another kind. I am logged in as a normal user. Now I type slash admin in the address bar. The admin page opens. The site checked who I am, but never checked what I am allowed to do.
Other kinds Broken access control has other forms too. A normal user opens an admin page just by typing its address, like you just saw. A user changes another user's password through an API. Changing role equals user to role equals admin in a request works. Or a deleted or hidden feature can still be used directly.
Quick check Quick check. A developer wants to fix the invoice bug you just saw. Which change actually fixes it? Think about where the check must happen, then choose.
The fix Now the fix. Every request passes an ownership check on the server. You ask for your own invoice. It belongs to you, so it goes through. You ask for someone else's. The server answers four oh three, Forbidden. And this happens every time, on every request.
How to defend To defend, check on the server, every time, that the logged-in user may access that exact record or action. Deny by default: if no rule allows access, block it. Random, hard to guess IDs, such as UUIDs, are an extra layer, not the fix. And write automated tests that try to access another user's data.
Putting it together Let us put it together. Authentication is who you are. Authorisation is what you may do. IDOR means changing an ID to reach a record that is not yours. Admin pages, APIs and roles can be broken in the same way. The fix is a server-side check on every request, denying by default. Now read the lesson below, and try the lab.
The OWASP Top 10 is a widely used list of the most critical web application risks. In its latest editions, Broken Access Control is at number one.
Authentication vs authorisation
These two words are easy to confuse:
- Authentication: who are you? (logging in)
- Authorisation: what are you allowed to do? (permissions)
Many websites do authentication well, then forget to check authorisation on every request.
What is IDOR?
IDOR stands for Insecure Direct Object Reference. It happens when:
- A website uses an ID to fetch a record, for example
/invoice?id=1042 - The user can change that ID
- The server returns the record without checking who owns it
GET /invoice?id=1042 → your invoice
GET /invoice?id=1041 → someone else's invoice!
IDs can appear in the URL, in form data, in API requests or in cookies. Testers look for them everywhere.
Real impact
IDOR bugs have exposed millions of records in real incidents: other people's orders, medical results, ID card scans and private messages. They are simple to exploit, which makes them dangerous.
Other kinds of broken access control
- A normal user can open an admin page by typing its address
- A user can change another user's password through an API
- Changing
role=usertorole=adminin a request works - A deleted or "hidden" feature can still be used directly
How to defend
- Check on the server, every time, that the logged-in user is allowed to access that exact record or action
- Deny by default: if there is no rule that allows access, block it
- Use random, hard-to-guess IDs (such as UUIDs) as an extra layer, not as the only fix
- Write automated tests that try to access another user's data
In the lab, you will read invoices that do not belong to you.
HANDS-ON LAB
Someone Else's Invoice
You can see your own invoice. Can you see other people's?
Check your understanding
Answer every question correctly to complete this lesson. If you miss one, try the quiz again.
1. What is the difference between authentication and authorisation?
2. A URL shows /orders?id=5531. You change it to 5530 and see another customer's order. What is this?
3. What is the correct fix for IDOR?
Locked: answer every quiz question above correctly to complete this lesson.
Spotted a mistake or something unclear? Report a mistake