HACKORY
Language · English
← All chapters
HACKORY / Open library

Access to other people’s objects (IDOR and BOLA)

Every invoice, order, or photo in an app has a number that identifies it: its ID. Knowing that number should not be enough to see it. IDOR is the flaw where the app returns or changes someone else’s object just because someone asked for its number.

New here? Try the first lesson without an account

How it works

IDOR stands for insecure direct object reference. A direct reference means the address names the object as it is, such as /api/facturas/101: 101 is the invoice. It is insecure if the server returns it without checking whose it is. APIs use the term BOLA, broken object level authorization: the same problem under another name.

Expected behavior

Ana requests /api/facturas/101, and the server checks that the invoice belongs to her.

What can go wrong

She changes 101 to 102, which belongs to Bruno, and the API returns or modifies the invoice without checking whose it is.

What to observe

Use two accounts of your own, each with its own invoice, and compare reading, editing, and what was saved in the end.

Common false positive

A 200 carrying an error page does not confirm access: check whether the body contains the other account’s data.

Why it matters

A valid account could read, edit, or delete other accounts’ data just by changing the number.

How to fix it

For every object and every action, the server uses the session to check who is asking and whether that object belongs to them or they have explicit permission.

Understand it step by step

A number selects, it does not authorize

The number 101 points to an invoice, just as a cloakroom number points to a coat. Holding the number does not prove the coat is yours: the attendant compares it with your ticket. The server does the same: it finds the invoice and checks its owner or an explicit permission. A long random ID, such as a UUID (a long string of random letters and numbers), makes other IDs harder to guess, but it does not answer the permission question.

Two identities, two objects

Create or use two test accounts, Sol and Mara, each with one invoice. Save Sol’s normal response for her own invoice. With Sol’s session, request Mara’s invoice by changing only the ID. Confirm that the body contains Mara’s data and not a generic page with a 200.

More than one form

IDOR can affect reading, editing, deleting, exporting, and objects that live inside others, such as an invoice’s comments. It does not appear only in the path /facturas/102 either: the number may travel in a JSON field of the body. The idea is always the same: a reference controlled by the requester reaches an operation without the server checking who is asking, which action, and on which object.

Recommend this chapter to a friend