IDOR and BOLA: when the number in the request is the only "check"
IDOR (BOLA in the OWASP API list) is when the server checks who the user is but not who owns the requested object. So another id exposes other people's data. The fix is an ownership condition on the server in every handler, not hiding things in the interface. A UUID does not replace the check, because ids leak. QA tests with two accounts of one role: read, change and delete.
Pentest · Access control
I changed 1001 to 1002 in the request and see someone else’s order. A bug or by design?
A tester logs in to an online shop as Alice, opens her order and sees the request GET /api/orders/1001 in the network tab. Out of curiosity he changes the number to 1002 and gets a full order card with a stranger’s delivery address. The token is the same, the server answered "200 OK". This lesson explains why that happens, how to check it without harming the system, and what the right fix looks like.
Mechanism. Authentication answers "who is this?": a token or a cookie proves the request came from Alice. Authorization answers another question: "may exactly Alice perform exactly this action on exactly this object?". If the server stops at the first question, substituting someone else’s identifier is enough to open access.
The classic name is IDOR (Insecure Direct Object Reference). In the OWASP API Security Top 10:2023 it is called BOLA (Broken Object Level Authorization) and sits at number API1. In the web Top 10:2025 it is part of A01 Broken Access Control. It is so common because authentication is usually done by one shared layer (middleware), while object ownership is business logic that every handler has to repeat. Forgetting one endpoint is enough. A scanner does not see it either: it does not know whose object is whose.
The same token, another number
Worked example. The tester works with two of his own test accounts in an authorized environment. First, Alice’s request for her own order:
GET /api/orders/1001 HTTP/1.1
Host: shop.example
Authorization: Bearer <token-alice>
HTTP/1.1 200 OK
{"id": 1001, "owner": "alice", "address": "..."}
Now the same token, but the number of Bob’s order (created from the second account):
GET /api/orders/1002 HTTP/1.1
Host: shop.example
Authorization: Bearer <token-alice>
HTTP/1.1 200 OK
{"id": 1002, "owner": "bob", "address": "..."}
The owner field in the response does not match the user from the token: that is the proof. It is enough for the report, there is no need to collect anyone’s real data. The cause is usually the same:
Where the owner check lives
orders.findById(id)
The token is checked, the owner is not. Any logged-in user sees any order.
orders.findOne({ id, ownerId: user.id })
The owner is part of the database query itself. A foreign number is simply "not found", and choosing 404 does not confirm the order exists.
A real case. In May 2019 the journalist Brian Krebs reported that the site of the insurer First American served documents by a link with a sequential number: changing one digit opened someone else’s file. No authentication was required. The site held about 885 million files, including financial documents. The company called it a "design defect in an application". In 2021 the company settled with the US regulator SEC and paid a penalty of 487,616 dollars: the executives who reported on the incident had not been told that the company’s own security staff had found the flaw months earlier and had not fixed it. The lesson: a sequential number without an access check is exactly the flaw described above, only on the scale of millions of records.
Limits and workarounds.
- UUID instead of 1, 2, 3. A random identifier makes guessing harder but does not replace the check: ids end up in logs, links, Referer headers and other API responses. Whoever sees one can open the object;
- Not only GET. Check reading, changing (
PUT,PATCH) and deleting (DELETE): protection is most often forgotten there; - Not only the path. An object number may sit in a query parameter, a JSON body, a header, a file name, a GraphQL query or a WebSocket message;
- Nested resources. In
/users/5/invoices/900the server may only check "5 from the token matches the path" and never check that invoice 900 belongs to user 5.
How QA checks it. You need two accounts of the same role (A and B) and, if possible, an admin. User A creates objects and writes down their numbers. Then A’s requests are replayed with B’s token: reading, changing, deleting. Status and body are compared with the owner’s response. A separate pass without a token. In Burp this is done by Repeater or the Autorize extension, in Postman by two environment variables with tokens. Only on a test environment or in a training lab (PortSwigger Web Security Academy, OWASP Juice Shop); on a third-party system only with written permission and within the scope.
Common mistakes.
- Checking access only in the interface (hiding foreign orders from the list). A direct request bypasses the UI, so protection there is useless;
- Treating an "unpredictable" number as protection. It only lowers the chance of a random guess;
- Answering 401 for a foreign object: 401 means "no valid credentials", and here they exist. The right answers are 404 or 403, with no data in the body.
Check yourself
GET /api/files/8f3c… (UUID v4) is served to any logged-in user. The team says: "a UUID cannot be guessed, so there is no IDOR". Is that right?
Answer
No. Guessing a UUID is indeed hard, but the identifier can be seen in a shared link, in logs or in a list that shows foreign files. Anyone who has it opens the file because nobody checks the owner. An owner (or permission) condition in the query is needed.
Alice’s request for a foreign order returned 200 with only {} in the body. Is there a flaw?
Answer
No foreign data is visible, so it is not a leak, but the behaviour is confusing: 200 says "the order exists and you are allowed". 404 (or 403) is more reliable. Also check that other methods (PUT, DELETE) on the same number do not work either, because an empty GET response says nothing about them.