Skip to the content

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:

RankCategoryIn plain words
A01Broken Access ControlUsers can do or see things they should not (now also includes SSRF)
A02Security MisconfigurationUnsafe settings: debug mode on, default passwords, open storage
A03Software Supply Chain FailuresVulnerable or malicious dependencies, compromised build tools (new; expands "Vulnerable and Outdated Components")
A04Cryptographic FailuresSensitive data not encrypted, or weak or misused cryptography
A05InjectionUntrusted input interpreted as code: SQL injection, command injection, and XSS
A06Insecure DesignMissing security thinking in the design itself
A07Authentication FailuresWeak login, session and password handling
A08Software or Data Integrity FailuresTrusting updates, data or code without verifying them
A09Security Logging and Alerting FailuresAttacks not recorded or not noticed
A10Mishandling of Exceptional ConditionsBad 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:

FormExample
IDOR (Insecure Direct Object Reference)Change /api/invoices/1043 to 1044 and see someone else's invoice
Vertical privilege escalationA normal user calls DELETE /api/admin/users/5 because only the button was hidden, not the endpoint protected
Horizontal escalationChanging userId in a request body to act as another user
Mass assignmentSending {"name":"Sam","role":"admin"} to a profile update that copies the whole body into the database
Forced browsingGuessing URLs such as /admin or /backup.zip
Missing checks on some methodsGET /orders/5 is checked, PATCH /orders/5 is not
Cross-tenant accessA user of company A reads company B's data (Lesson 203)
Trusting the clientPrice, role or permissions taken from the request or a client-side token without verification

IDOR, demonstrated

A vulnerable Express route:

TypeScript
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 fields
const { 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

WordMeaning
OWASP Top 10The standard list of critical web application risks
Broken access controlUsers doing or seeing things they should not
IDORAccessing another user's record by changing its ID
Privilege escalationGaining higher permissions than granted
Mass assignmentClients setting fields they should not by sending extra properties
Deny by defaultRefuse unless explicitly allowed

Now prove it

This lesson is complete when you pass the quiz and all three practice levels.