Guide

IDOR is still the #1 API bug: how we find it

Why object-level authorization keeps breaking, and the four places we look first.

An insecure direct object reference, or IDOR, is the simplest serious bug there is. Your app asks for an object by its id, the server checks that someone is signed in, and it never checks that the object belongs to them. Change /api/invoices/10481 to /api/invoices/10482 and you are reading another customer's invoice.

OWASP calls the API version of this Broken Object Level Authorization, or BOLA. It is number one in the OWASP API Security Top 10 2023, the same spot it held in the first edition in 2019. In the general OWASP Top 10 2021, Broken Access Control, the family IDOR belongs to, is also first. Four years and two editions later, the simplest bug is still the most important one.

Why it keeps happening

IDOR is not a coding mistake you can lint away. Each endpoint has to answer a business question: who may see this object? The framework knows the user is signed in. Only your code knows that invoice 10482 belongs to organisation B, that a manager may read a teammate's expense report but a teammate may not read the manager's, or that a deleted project should still be visible to an auditor.

So the check lives in hundreds of places, written by different people at different times. The list endpoint filters by organisation. The detail endpoint, added later for a mobile screen, forgets. The export endpoint, added for one enterprise customer, takes an id from the query string. Each one looks fine on its own in code review.

Scanners rarely catch it either. A scanner sees 200 OK with a JSON body and has no idea whether that body should have been visible to this user. To know that, you need two accounts and an understanding of what each one owns.

How our agents look for it

Our AI agents test with at least two accounts per role that you give us. In recon, they map every request that carries an identifier: path segments, query parameters, JSON fields, GraphQL arguments, headers. Then they work through four places where object checks are most often missing.

1. The second endpoint for the same object

If GET /api/invoices/{id} is checked, the agent tries /api/invoices/{id}/pdf, /api/v1/invoices/{id}, the export, the share link and the GraphQL node query. Older API versions and side doors for one feature are where the check was forgotten.

2. Writes, not just reads

Reading someone else's data is bad. Changing it is often worse, and write endpoints are checked less carefully. The agent tries PATCH and DELETE with account A's session on account B's objects, and checks whether a body field such as organisation_id or owner_id is honoured when it should be ignored.

3. Ids you were never shown

Sequential ids are easy to guess, but UUIDs are not a fix. They leak through list endpoints, webhooks, invite emails, URLs in analytics and error messages. The agent collects every id it sees as account A and replays it as account B.

4. Role edges inside one tenant

Many apps check the organisation and stop there. Inside one organisation, a viewer may still reach an admin's API key settings, or a former member may still fetch files through an old link. The agent repeats each request across every role you gave us and compares what comes back.

No exploit, no finding

A different response is not proof. Some objects are meant to be shared. So when an agent sees account B get data that looks like account A's, it does not report it yet. It replays the exact request from a clean session, compares the response with what account A sees, and checks that the data is really A's and not public. If the replay does not reproduce, the finding is dropped. If it does, the report shows the exact request, the redacted response, the CVSS 3.1 score and the fix.

How to fix it for good

The fix for one endpoint is a one-line ownership check. The fix for the class of bug is to stop writing that line by hand:

  • Load objects through a scoped query, such as invoices.forOrg(user.orgId).find(id), so the unscoped path does not exist.
  • Put the policy in one place and call it from every handler, including exports, files and GraphQL resolvers.
  • Write one test per endpoint that requests another tenant's object and expects 404.
  • Ignore ownership fields in request bodies and set them on the server.

Random ids make guessing harder, but they only buy time. The check is what closes the bug.

Want to see this on your own app?

Your first report is free, and no card is needed.

15-minute call

Talk to our team

A 15-minute call about your app, your deadline and what your auditor, insurer or customer needs to see.