Lesson 259 of 296
The OWASP Top 10, broken access control and IDOR
What you will learn
- What OWASP and the Top 10 are
- The 2025 list in plain words
- Broken access control: the number one risk
- IDOR, privilege escalation and mass assignment
- A defence checklist
On this page
OWASP and the Top 10
OWASP (the Open Worldwide Application Security Project) is a non-profit that publishes free security guidance. Its Top 10 lists the most critical web application security risks, based on data from many organisations. The current edition is 2025:
| Rank | Category | In plain words |
|---|---|---|
| A01 | Broken Access Control | Users can do or see things they should not (now also includes SSRF) |
| A02 | Security Misconfiguration | Unsafe settings: debug mode on, default passwords, open storage |
| A03 | Software Supply Chain Failures | Vulnerable or malicious dependencies, compromised build tools (new; expands "Vulnerable and Outdated Components") |
| A04 | Cryptographic Failures | Sensitive data not encrypted, or weak or misused cryptography |
| A05 | Injection | Untrusted input interpreted as code: SQL injection, command injection, and XSS |
| A06 | Insecure Design | Missing security thinking in the design itself |
| A07 | Authentication Failures | Weak login, session and password handling |
| A08 | Software or Data Integrity Failures | Trusting updates, data or code without verifying them |
| A09 | Security Logging and Alerting Failures | Attacks not recorded or not noticed |
| A10 | Mishandling of Exceptional Conditions | Bad error handling, logic errors and "failing open" (new) |
Changes from the 2021 edition worth mentioning in interviews: Security Misconfiguration rose from 5th to 2nd, SSRF was merged into Broken Access Control, and two new categories appeared: supply chain failures and mishandling of exceptional conditions.
Broken access control
Access control (authorisation, Lesson 203) decides what an authenticated user may do. It is broken when the server does not check properly. It has been number one since 2021. Forms it takes:
| Form | Example |
|---|---|
| IDOR (Insecure Direct Object Reference) | Change /api/invoices/1043 to 1044 and see someone else's invoice |
| Vertical privilege escalation | A normal user calls DELETE /api/admin/users/5 because only the button was hidden, not the endpoint protected |
| Horizontal escalation | Changing userId in a request body to act as another user |
| Mass assignment | Sending {"name":"Sam","role":"admin"} to a profile update that copies the whole body into the database |
| Forced browsing | Guessing URLs such as /admin or /backup.zip |
| Missing checks on some methods | GET /orders/5 is checked, PATCH /orders/5 is not |
| Cross-tenant access | A user of company A reads company B's data (Lesson 203) |
| Trusting the client | Price, role or permissions taken from the request or a client-side token without verification |
IDOR, demonstrated
A vulnerable Express route:
import express from "express";
type Invoice = { id: number; ownerId: string; amountPence: number };
const invoices: Invoice[] = [
{ id: 1043, ownerId: "alice", amountPence: 12000 },
{ id: 1044, ownerId: "bob", amountPence: 99000 }
];
export function buildInvoiceApp() {
const app = express();
app.use((req, res, next) => {
res.locals.userId = req.header("x-test-user");
next();
});
app.get("/vulnerable/invoices/:id", (req, res) => {
const invoice = invoices.find((i) => i.id === Number(req.params.id));
if (!invoice) {
res.status(404).json({ error: "Not found" });
return;
}
res.json(invoice);
});
app.get("/safe/invoices/:id", (req, res) => {
const userId = res.locals.userId as string | undefined;
if (!userId) {
res.status(401).json({ error: "Sign in required" });
return;
}
const invoice = invoices.find((i) => i.id === Number(req.params.id) && i.ownerId === userId);
if (!invoice) {
res.status(404).json({ error: "Not found" });
return;
}
res.json(invoice);
});
return app;
}(The x-test-user header stands in for a real session so the example is short; real code reads the user from a verified session or token, Lesson 200.) In testing, Alice requesting invoice 1044 from the vulnerable route received Bob's invoice for £990. The safe route returned 404 for the same request and still returned her own invoice 1043. The fix is one condition: the ownership check is part of the lookup.
Mass assignment
await db.user.update({ where: { id }, data: req.body }); vulnerable: the client chooses the fieldsconst { name, bio } = UpdateProfileSchema.parse(req.body); safe: an allow-list of fields
await db.user.update({ where: { id }, data: { name, bio } });Use a strict schema (z.strictObject, NestJS whitelist with forbidNonWhitelisted, Lesson 210).
Defence checklist
- Deny by default; every endpoint explicitly states who may call it.
- Check on the server, on every request, for every method; hiding buttons is not security.
- Put ownership and tenant checks in the data access layer, ideally inside the query (Lesson 203).
- Return 404 for records the user may not see, to avoid revealing that they exist.
- Use unguessable IDs (UUIDs) as extra protection, never as the only protection.
- Allow-list writable fields.
- Re-check permissions for actions on lists and exports (bulk endpoints often forget).
- Rate limit and log access-denied events; many 403s or 404s from one user may be an attack (Lesson 263).
- Test forbidden paths: user A against user B's resources, every role against admin routes.
How to say it in an interview
"The OWASP Top 10 is the standard list of critical web risks; in the 2025 edition broken access control is still first, security misconfiguration rose to second, SSRF was merged into access control, and supply chain failures and mishandling of exceptional conditions are new. Broken access control includes IDOR, privilege escalation, mass assignment and cross-tenant access. I deny by default, check authorisation on the server for every request and method, put ownership and tenant conditions in the query itself, return 404 for records users may not see, allow-list writable fields, and write tests proving user A cannot reach user B's data."
Key words
| Word | Meaning |
|---|---|
| OWASP Top 10 | The standard list of critical web application risks |
| Broken access control | Users doing or seeing things they should not |
| IDOR | Accessing another user's record by changing its ID |
| Privilege escalation | Gaining higher permissions than granted |
| Mass assignment | Clients setting fields they should not by sending extra properties |
| Deny by default | Refuse unless explicitly allowed |
Now prove it
This lesson is complete when you pass the quiz and all three practice levels.